Link to home
Start Free TrialLog in
Avatar of jlguerra

asked on

Command text was not set for the command object.

Hi experts,

I have an application ASP and when i execute a UPDATE sentence the server show me this message.  I use a Access Data Base with filedsn OLEDB

      "Microsoft OLE DB Provider for ODBC Drivers (0x80040E0C)
      Command text was not set for the command object."

Avatar of jrram
Flag of United States of America image

Give us some code please.... this error means that when you called

the objConn.Execute (whatever)...

the whatever cannot be found...
Avatar of Carl Tawn
More likely you are using a Command object:

    Set cmd = Server.CreateObject("ADODB.Command")
    cmd.CommandText = "UPDATE Something SET SomeField = SomeValue"                   '<-- This is what the error refers to
Avatar of jlguerra


This is the code:

Dim cnnDirec
Set cnnDirec = Server.CreateObject("ADODB.Connection")

cnnDirec.Open cnnDSN

strSQL = "UPDATE Organismos SET "
strSQL = strSQL & " Nombre_Organismo = '" & strNombreOrganismo & "', descripcion_organismo = " & "'" & strDescripcionOrganismo & "' "
strSQL = strSQL & " WHERE Codigo_Interno_Organismo = '" & strCodigoInternoOrganismo & "'"

cnnDirec.Execute strSQL
always what i execute the Update Or Delete the error show me
Avatar of carlmahon

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Please i need help, the error is:

    Microsoft OLE DB Provider for ODBC Drivers (0x80040E0C)
    Command text was not set for the command object.
That is generally an error in your SQL string. Also check to make sure the variables you are using are valid and don't have invalid characters.

strSQL = "UPDATE Organismos SET " & _
     "Nombre_Organismo = '" & Replace(strNombreOrganismo,"'","''") & _
     "', descripcion_organismo = '" & Replace(strDescripcionOrganismo,"'","''") & "' " & _
     "WHERE Codigo_Interno_Organismo = '" & strCodigoInternoOrganismo & "'"
If the above statement does not work add


and post the full SQL string that is being passed.
Then try a simple SQL statement like

strSQL = "Select * From Organismos" to make sure that connection is valid.

This will help isolate the cause of the error
oops, is my error,  sorry