Hi,
I seem to be getting the error "Syntax error in UPDATE statement." when attempting to update my database through visual studio 2008, using forms.
Here is the code for the connection:
Private Sub btnLoadDB_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLoadDB.Click
Provider = "PROVIDER=MICROSOFT.ACE.OLEDB.12.0;"
Source = "Data Source = F:\My Documents\Computing\COMP4\COMP4 CW\WND.accdb"
connection.ConnectionString = Provider & Source
connection.Open()
sqlCode = "SELECT * FROM Newspapers"
dAdapter = New OleDb.OleDbDataAdapter(sqlCode, connection)
dAdapter.Fill(dSet, "Newspapers")
MsgBox("Database Loaded.", MsgBoxStyle.Information)
connection.Close()
maxRows = dSet.Tables("Newspapers").Rows.Count
incr = -1
End Sub
The code for the update button on my form:
Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdate.Click
Dim cBuilder As New OleDb.OleDbCommandBuilder(dAdapter)
dSet.Tables("Newspapers").Rows(incr).Item(0) = txtPMID.Text
dSet.Tables("Newspapers").Rows(incr).Item(1) = txtPMName.Text
dSet.Tables("Newspapers").Rows(incr).Item(2) = txtPMPrice.Text
dAdapter.Update(dSet, "Newspapers")
MsgBox("The record was successfully updated", MsgBoxStyle.Information)
End Sub
Any help would be greatly appreciated.
Thanks
Collin
(p.s. I am using the following tutorial: