説明なし
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

原代碼存放區.vb 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. Option Strict Off
  2. Imports System.Data.SqlClient
  3. Public Class 原代碼存放區
  4. Dim conn As New SqlConnection
  5. Dim da As New SqlDataAdapter
  6. Dim cmd As New SqlCommand
  7. Dim ds As New DataSet
  8. Dim dr As SqlDataReader
  9. Private Sub Set_使用者清單()
  10. DataGridView1.DataSource = Nothing : ds.Clear()
  11. DataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  12. DataGridView1.ColumnHeadersHeight = 25
  13. DataGridView1.AllowUserToAddRows = False
  14. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  15. SQL1 = "SELECT 對應客戶, 檔案名稱 FROM 原代碼管理"
  16. cmd.Connection = conn : cmd.CommandText = SQL1 : da.SelectCommand = cmd : da.Fill(ds) : DataGridView1.DataSource = ds.Tables(0) : conn.Close() : Set_grid()
  17. End Sub
  18. Private Sub Set_grid()
  19. DataGridView1.Columns(0).Width = 100 : DataGridView1.Columns(1).Width = 200
  20. End Sub
  21. Private Sub 原代碼存放區_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  22. Me.MdiParent = GCM_ERP_SYS : Me.WindowState = 2 : Me.AutoScroll = True
  23. Set_使用者清單()
  24. Target1 = Target & AA(2) & "/"
  25. WebBrowser1.Url = New Uri(Target1)
  26. If FolderBrowserDialog1.ShowDialog = DialogResult.OK Then
  27. WebBrowser2.Navigate(FolderBrowserDialog1.SelectedPath)
  28. End If
  29. End Sub
  30. Private Sub 登入閒置控制_MouseMove(sender As Object, e As EventArgs) Handles MyBase.MouseMove
  31. timeNow = 0
  32. GCM_ERP_SYS.Timer1.Enabled = False
  33. GCM_ERP_SYS.Timer1.Enabled = True
  34. End Sub
  35. Private Sub 登入閒置控制_KeyPress(sender As Object, e As EventArgs) Handles MyBase.KeyPress
  36. timeNow = 0
  37. GCM_ERP_SYS.Timer1.Enabled = False
  38. GCM_ERP_SYS.Timer1.Enabled = True
  39. End Sub
  40. Private Sub DataGridView1_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles DataGridView1.CellClick
  41. If e.RowIndex = -1 Then : Else
  42. TextBox1.Text = DataGridView1(0, e.RowIndex).Value.ToString : TextBox2.Text = DataGridView1(1, e.RowIndex).Value.ToString
  43. End If
  44. End Sub
  45. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  46. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  47. SQL1 = "INSERT INTO 原代碼管理 (對應客戶, 檔案名稱) " &
  48. "VALUES (N'" & TextBox1.Text & "',N'" & TextBox2.Text & "')"
  49. cmd.Connection = conn : cmd.CommandText = SQL1 : cmd.ExecuteNonQuery()
  50. conn.Close()
  51. Set_使用者清單()
  52. End Sub
  53. Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
  54. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  55. SQL1 = "UPDATE 原代碼管理 SET 檔案名稱 = N'" & TextBox2.Text & "' WHERE (對應客戶 = N'" & TextBox1.Text & "')"
  56. cmd.Connection = conn : cmd.CommandText = SQL1 : cmd.ExecuteNonQuery()
  57. conn.Close()
  58. Set_使用者清單()
  59. End Sub
  60. Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
  61. SQL1 = "DELETE FROM 原代碼管理 WHERE (對應客戶 = N'" & TextBox1.Text & "')"
  62. cmd.CommandText = SQL1 : cmd.Connection = conn
  63. If conn.State = ConnectionState.Closed Then : conn.Open() : End If
  64. Dim aa As MsgBoxResult
  65. aa = MsgBox("確定要刪除該筆資料?", MsgBoxStyle.OkCancel)
  66. If aa = MsgBoxResult.Ok Then : cmd.ExecuteNonQuery() : End If
  67. conn.Close()
  68. Set_使用者清單()
  69. End Sub
  70. Private Sub Button14_Click(sender As Object, e As EventArgs) Handles Button14.Click
  71. If FolderBrowserDialog1.ShowDialog = DialogResult.OK Then
  72. WebBrowser2.Navigate(FolderBrowserDialog1.SelectedPath)
  73. End If
  74. End Sub
  75. End Class