hi,anyone can help me on my error, im just new in vb.net, i got some problems on my query, i get errors("Syntax Error in INSERT INTO Statement") can you check which is wrong on this code...
Dim li as ListViewItem
Dim query as String = ""
Dim com as OleDbCommand
Try
With li
query = "Insert into tab1(Names, Price, Quantity, Total) Values" query += "(" & ListView1.Items(0).Text & ", " & .SubItems(1).Text & ", " & .SubItems(2).Text & ", " & .SubItems(3).Text & ")" com = New OleDbCommand(query, scon) com.ExecuteNonQuery() MsgBox("Success!", MsgBoxStyle.Information, "Success")
End With
Catch ex As Exception
MsgBox(ex.Message)
End Try
Dim li as ListViewItem
Dim query as String = ""
Dim com as OleDbCommand
Try
With li
query = "Insert into tab1(Names, Price, Quantity, Total) Values" query += "(" & ListView1.Items(0).Text & ", " & .SubItems(1).Text & ", " & .SubItems(2).Text & ", " & .SubItems(3).Text & ")" com = New OleDbCommand(query, scon) com.ExecuteNonQuery() MsgBox("Success!", MsgBoxStyle.Information, "Success")
End With
Catch ex As Exception
MsgBox(ex.Message)
End Try
Last edited: