S
Sean
I am trying to execute a simple SQL Update command on an Access
database. I have an OleDBConnection (gDatabaseConn) that has
successfully been executing select commands, but I cannot get an update
command to work. Here is the code in question:
Dim cmdUpdate As New OleDb.OleDbCommand("", gDatabaseConn)
sSQL = "UPDATE NoteTable SET AcctID = '" & Account.sAcctID
sSQL = sSQL & "' WHERE AcctNo = '" & Account.sAccountNo & "'"
cmdUpdate.CommandText = sSQL
cmdUpdate.ExecuteNonQuery()
The call to ExecuteNonQuery throws an exception with the message "No
value given for one or more required parameters". Both of the
variables used in the string have values. Is ADO.NET capable of
running a simple SQL command like this, or do I need to investigate
OleDBParameter objects? This way would be preferrable, since I am not
using DataTables or DataRows.
database. I have an OleDBConnection (gDatabaseConn) that has
successfully been executing select commands, but I cannot get an update
command to work. Here is the code in question:
Dim cmdUpdate As New OleDb.OleDbCommand("", gDatabaseConn)
sSQL = "UPDATE NoteTable SET AcctID = '" & Account.sAcctID
sSQL = sSQL & "' WHERE AcctNo = '" & Account.sAccountNo & "'"
cmdUpdate.CommandText = sSQL
cmdUpdate.ExecuteNonQuery()
The call to ExecuteNonQuery throws an exception with the message "No
value given for one or more required parameters". Both of the
variables used in the string have values. Is ADO.NET capable of
running a simple SQL command like this, or do I need to investigate
OleDBParameter objects? This way would be preferrable, since I am not
using DataTables or DataRows.