How to do a simple update command with ado.net?

Tech-Archive recommends: Fix windows errors by optimizing your registry



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.

.



Relevant Pages

  • Re: How to do a simple update command with ado.net?
    ... I believe your SQL is incorrect. ... >I am trying to execute a simple SQL Update command on an Access ... I have an OleDBConnection (gDatabaseConn) that has ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: How to do a simple update command with ado.net?
    ... 90% of the time it's best to create a Parameter-based Command to handle ... The Command deals with a litany of issues ... >I am trying to execute a simple SQL Update command on an Access ... I have an OleDBConnection (gDatabaseConn) that has ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: How to do a simple update command with ado.net?
    ... ¤ I am trying to execute a simple SQL Update command on an Access ... I have an OleDBConnection (gDatabaseConn) that has ...
    (microsoft.public.dotnet.framework.adonet)
  • [Full-Disclosure] Advanced usage of system() function.
    ... and call its arguments as a command for shell. ... as we can see we still didnt get what we want (typing exit ... Connection closed by foreign host. ... think what we want to execute. ...
    (Full-Disclosure)
  • Advanced usage of system() function.
    ... and call its arguments as a command for shell. ... as we can see we still didnt get what we want (typing exit we are ... Connection closed by foreign host. ... think what we want to execute. ...
    (Bugtraq)