90% of the time it's best to create a Parameter-based Command to handle
queries--even action commands. The Command deals with a litany of issues
that you might never think of until you try to figure out what's wrong.
--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
"Sean" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>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.
>