 |
|
กดบันทึกข้อมูลแล้ว ข้อมูลไม่เข้า...... ตามนี้เลยครับ ข้อมูลของ Listbox ไม่เข้าครับ |
|
 |
|
|
 |
 |
|
Code (VB.NET)
Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click
Dim Conn As New OleDbConnection(strConnection)
Dim Comm As New OleDb.OleDbCommand()
Conn.Open()
Dim strSQL As String
Dim strSQL2 As String
strSQL = "insert into [GROUP_USERS] ([GROUP_USER],[USER_NAME],[Create_Date]) values ('" & TextBox1.Text & "','" & ListBox1.Text & "', getdate()) "
strSQL2 = "insert into [PERMISSION_REPORTS] ([GROUP_USER],[USER_NAME],[Create_Date]) values ('" & TextBox1.Text & "','" & ListBox1.Text & "', getdate())"
Dim i As Integer
Comm.Connection = Conn
Comm.CommandType = CommandType.Text
Comm.CommandText = strSQL
Comm.ExecuteNonQuery()
Comm.CommandText = strSQL2
Comm.ExecuteNonQuery()
For i = 0 To ListBox1.Items.Count - 1
Comm.Parameters.AddWithValue("USER_NAME", ListBox1.Items.Item(i))
Next
Comm.ExecuteNonQuery()
Conn.Dispose()
Comm.Dispose()
'MessageBox.Show(strSQL)
Me.Close()
User_Group_List.Show()
End Sub
ตามนี้เลยครับ ข้อมูลของ Listbox ไม่เข้าครับ
Tag : .NET, VBScript, VB.NET
|
|
 |
 |
 |
 |
Date :
2017-06-28 15:26:06 |
By :
stepartz |
View :
995 |
Reply :
3 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ลองดู
Code (VB.NET)
strSQL2 = "insert into [PERMISSION_REPORTS] ([GROUP_USER],[USER_NAME],[Create_Date]) values ('" & TextBox1.Text & "','" & ListBox1.Text & "', getdate())"
แล้วลองหา โค้ด insert มาเปรียบเทียบดูครับว่าเขาเขียนกันยังไง
|
 |
 |
 |
 |
Date :
2017-06-28 15:46:37 |
By :
lamaka.tor |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ทำได้แล้วครับ หาอยู่ตั้งนาน
|
 |
 |
 |
 |
Date :
2017-08-11 09:13:44 |
By :
stepartz |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|

|
 |
 |
 |
 |
Date :
2017-08-15 17:05:43 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|