Problem with Updating a record in MS Access

Victor

Member
Joined
Dec 14, 2004
Messages
7
Programming Experience
10+
Hello All,

I am trying to use simple update statement but I am keep getting this error message:

An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll


Following is the code I am trying to execute:

Dim strSQL as string

strSQL = "PROVIDER=Microsoft.Jet.oLEDB.4.0;Data " & "Source=C:\xxx\xxxx.mdb"
Dim conn As New OleDbConnection(strSQL)

Dim cmd As New OleDbCommand("Update table_name set column_name = test", conn)

cmd.CommandType = CommandType.Text

conn.Open()

cmd.ExecuteNonQuery()

conn.Close()

conn =
Nothing

cmd = Nothing


Could someone please tell me what am I doing wrong here?

Thanks.
 
Incase you missed it in the other post :

What's the exact error?
Could be the permissions on your DB, you need to add asp-net user.

TPM
 
Error Message I am getting is:

An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll

Also I have tried executing delete statement, it works fine, it is Update statement.


Thanks.
 
:s ok, well the only things I can think of are either it doesn't like an update with no where in it, or somethings screwed up your dll file.

If I think of anything else I'll let you know.

TPM

PS use a try, catch ex as OleDbException to get a more precise error message.
 
Thanks all for the input.


I think I have solved the problem by putting square[] brackets around the column names, I do not why but it works even though column names do not have space in them.
 
Back
Top