Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Syntax error in Update command !!!???

2 views
Skip to first unread message

Tommy DN

unread,
Mar 21, 2005, 8:28:49 AM3/21/05
to
When I want to update an access tablerow in vb.net, I got an ' syntax
error in update statement '. I've searched the internet for 2 hours
right now, and I tried everything, placing names in brackets and I've
also tested it with a simple update statement ( now placed as a
comment quote ' ).
Everything fails, and everything seems logical. So, I don't not what
to do anymore.

The code is:

---
Public Function updateInterimkantoor(ByVal id As Integer, ByVal
naam As String)
command = New OleDb.OleDbCommand
command.CommandText = "update [interimkantoor] set
[interimkantoor - id] = " & id & ", set [naam] = '" & naam & "' where
[interimkantoor - id] = " & id & ")"
'command.CommandText = "update [azz] set [azt] = 'niks' where
[azi] = 1"
command.Connection = connection
Try
command.ExecuteNonQuery() ' <-- FAILS HERE
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Function
---

I already maked a insert function, and this works very nice

---
Public Function saveInterimkantoor(ByVal naam As String)
command = New OleDb.OleDbCommand
command.CommandText = "insert into interimkantoor(naam)
values('" & naam & "')"
command.Connection = connection
'Try
command.ExecuteNonQuery()
'Catch ex As Exception
' MsgBox(ex.ToString)
'End Try
End Function
---

Can someone help me?

0 new messages