You are on page 1of 1

I have a simple vb.

net app and I'm trying to update a one row Access table with data from
some textboxes. This is a learning exercise for me as I am coming back from not
programming for almost 10 years, and know there are lots of other ways to manage this data,
but I'm just trying to understand different aspects of ADO.net a little better.
The ERROR I'm trapping is:
"Syntax error in UPDATE Statement"
Any thought's as to what is going on? (See CODE and stuff below)
Much Thanks, in advance!!!
Here's the Scheme printed from ACCESS showing the exact spelling of the database table
and column names:
Table: MaxTime
Name Type Size
ID Long Integer 4
Container Text 10
Vehicle Text 10
Exterior Text 10
Interior Text 10
The SQL UPDATE string looks like this (from the debugger just before it's executed):
UPDATE MaxTime SET Container = '1111', Vehicle = '2222', Exterior = '3333', Interior =
'4444';
And here's the code

1. Dim strSQL As String


2.
3. strSQL = String.Concat("UPDATE MaxTime SET Container = '", txtMaxCo
ntainerTime.Text, "', Vehicle = '", txtMaxVehicleTime.Text, "', Exterior =
'", txtMaxExteriorTime.Text, "', Interior = '", txtMaxInteriorTime.Text, "'
;")
4.
5.
6. Try
7. dbConnection = New OleDbConnection("PROVIDER=Microsoft.Jet.OLED
B.4.0;Data Source = ShowData.mdb")
8. dbCommand = New OleDbCommand(strSQL, dbConnection)
9.
10. dbCommand.Connection.Open()
11. dbCommand.ExecuteNonQuery()
12.
13. dbCommand.Dispose()
14. dbConnection.Close()
15.
16. Catch ex As Exception
17. MsgBox(ex.Message)
18. End Try

You might also like