Hi, I need a little help here. I'm Using vs 2005 with ms access 2003 database and finding myself how to get rid of this error "Syntax Error on UPDATE Statement" can you take a look at my codes below and tell me what's wrong? Thank you.
Public Class Transactions
Dim cnnOLEDB As New OleDbConnection
Dim cmdOLEDB As New OleDbCommand
Dim cmdInsert As New OleDbCommand
Dim cmdUpdate As New OleDbCommand
Dim strConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & System.Environment.CurrentDirectory & "\LibraryDatabase.mdb"
Private Sub Transactions_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.CenterToScreen()
cnnOLEDB.ConnectionString = strConnectionString
cnnOLEDB.Open()
End Sub
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
i = "SELECT Lib_Book1,Lib_Book2,Lib_Book3 FROM members WHERE ID=" & txtmem_id.Text & " ;"
j = "SELECT ID FROM books WHERE ID=" & txtbook_id.Text & " ;"
If txtmem_id.Text <> "" And txtbook_id.Text <> "" And txtborrow_from.Text <> "" And txtborrow_until.Text <> "" Then
cmdUpdate.CommandText = "UPDATE books SET Borrowed_By, Bk_Status, Bk_From, Bk_Due = '" & txtmem_id.Text & "', '" & "Borrowed" & "', '" & txtborrow_from.Text & "', '" & txtborrow_until.Text & "' WHERE ID = " & txtbook_id.Text & ";"
cmdUpdate.CommandType = CommandType.Text
cmdUpdate.Connection = cnnOLEDB
cmdUpdate.ExecuteNonQuery()
MsgBox("Transaction Recorded.")
txtmem_id.Text = String.Empty
txtbook_id.Text = String.Empty
txtborrow_from.Text = String.Empty
txtborrow_until.Text = String.Empty
Else
MsgBox("Error to be set later!")
End If
cmdUpdate.Dispose()
End Sub
Please help :(