is MONTH column of type Number?
Main Topics
Browse All TopicsDear all,
The update sql command below works fine from within Access, but failed when called through an OleDbCommand instance:
UPDATE dat SET MONTH = Null WHERE MONTH Is Not Null
Some info:
The connection is opened without problem and other single record update is successfully done through this connection
In the 'dat' table, the MONTH column has some Null (empty) and some zero, the intent is to set all to empty or Null for this field. This MONTH column has no constraint on it whatsoever, it is numeric.
OleDbCommand complains about Update Syntax Error. The code snippet is attached.
As a matter of fact, just for grin, the OleDbCommand failed on the following update as well:
UPDATE dat SET MONTH = 0 WHERE MONTH = 0
Please help,
T
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
try getting exact error by using try catch block:
Dim lDbFileName As String = "C:\myDB.mdb"
Dim CnInput As New OleDbConnection("Provider=
Dim lSQL As String
Dim lUpdateCommand As OleDbCommand
Try
CnInput.Open()
lSQL = "UPDATE dat SET MONTH = Null WHERE MONTH Is Not Null"
lUpdateCommand = New OleDbCommand(lSQL, CnInput)
lUpdateCommand.CommandTime
lUpdateCommand.ExecuteNonQ
Catch ex as Exception
MessageBox.Show(ex.Message
End Try
Business Accounts
Answer for Membership
by: YZlatPosted on 2009-08-12 at 09:07:05ID: 25080106
did you try running this query directly in access?