Нема описа
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

FTP資料夾管理.vb 3.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. Option Strict Off
  2. Imports System.Data.SqlClient
  3. Public Class FTP資料夾管理
  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. Private Sub Set_使用者清單()
  9. DataGridView1.DataSource = Nothing : ds.Clear()
  10. DataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  11. DataGridView1.ColumnHeadersHeight = 25
  12. DataGridView1.AllowUserToAddRows = False
  13. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  14. SQL1 = "SELECT 資料夾名稱, 指定頁面, 備註, 指定 FROM FTP資料夾管理"
  15. cmd.Connection = conn : cmd.CommandText = SQL1 : da.SelectCommand = cmd : da.Fill(ds) : DataGridView1.DataSource = ds.Tables(0) : conn.Close() : Set_grid()
  16. End Sub
  17. Private Sub Set_grid()
  18. DataGridView1.Columns(0).Width = 70 : DataGridView1.Columns(1).Width = 200 : DataGridView1.Columns(2).Width = 200 : DataGridView1.Columns(3).Width = 70
  19. End Sub
  20. Private Sub FTP資料夾管理_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  21. Me.MdiParent = GCM_ERP_SYS : Me.WindowState = 2 : Me.AutoScroll = True
  22. Set_使用者清單()
  23. Target1 = Target
  24. WebBrowser1.Url = New Uri(Target1)
  25. End Sub
  26. Private Sub 登入閒置控制_MouseMove(sender As Object, e As EventArgs) Handles MyBase.MouseMove
  27. timeNow = 0
  28. GCM_ERP_SYS.Timer1.Enabled = False
  29. GCM_ERP_SYS.Timer1.Enabled = True
  30. End Sub
  31. Private Sub 登入閒置控制_KeyPress(sender As Object, e As EventArgs) Handles MyBase.KeyPress
  32. timeNow = 0
  33. GCM_ERP_SYS.Timer1.Enabled = False
  34. GCM_ERP_SYS.Timer1.Enabled = True
  35. End Sub
  36. Private Sub DataGridView1_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles DataGridView1.CellClick
  37. If e.RowIndex = -1 Then : Else
  38. TextBox1.Text = DataGridView1(0, e.RowIndex).Value.ToString : TextBox2.Text = DataGridView1(1, e.RowIndex).Value.ToString : TextBox3.Text = DataGridView1(2, e.RowIndex).Value.ToString
  39. TextBox4.Text = DataGridView1(3, e.RowIndex).Value.ToString
  40. End If
  41. End Sub
  42. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  43. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  44. SQL1 = "INSERT INTO FTP資料夾管理 (資料夾名稱, 指定頁面, 備註, 指定) " &
  45. "VALUES (N'" & TextBox1.Text & "',N'" & TextBox2.Text & "',N'" & TextBox3.Text & "',N'" & TextBox4.Text & "')"
  46. cmd.Connection = conn : cmd.CommandText = SQL1 : cmd.ExecuteNonQuery()
  47. conn.Close()
  48. Set_使用者清單()
  49. End Sub
  50. Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
  51. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  52. SQL1 = "UPDATE FTP資料夾管理 SET 指定頁面 = N'" & TextBox2.Text & "', 備註 = N'" & TextBox3.Text & "', 指定 = N'" & TextBox4.Text & "' WHERE (資料夾名稱 = N'" & TextBox1.Text & "')"
  53. cmd.Connection = conn : cmd.CommandText = SQL1 : cmd.ExecuteNonQuery()
  54. conn.Close()
  55. Set_使用者清單()
  56. End Sub
  57. Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
  58. SQL1 = "DELETE FROM FTP資料夾管理 WHERE (資料夾名稱 = N'" & TextBox1.Text & "')"
  59. cmd.CommandText = SQL1 : cmd.Connection = conn
  60. If conn.State = ConnectionState.Closed Then : conn.Open() : End If
  61. Dim aa As MsgBoxResult
  62. aa = MsgBox("確定要刪除該筆資料?", MsgBoxStyle.OkCancel)
  63. If aa = MsgBoxResult.Ok Then : cmd.ExecuteNonQuery() : End If
  64. conn.Close()
  65. Set_使用者清單()
  66. End Sub
  67. End Class