Avatar of jlguerra
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."

ASP

Avatar of undefined
Last Comment
jlguerra

8/22/2022 - Mon
jrram

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

the objConn.Execute (whatever)...

the whatever cannot be found...
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
jlguerra

ASKER
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
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
jlguerra

ASKER
always what i execute the Update Or Delete the error show me
ASKER CERTIFIED SOLUTION
carlmahon

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
jlguerra

ASKER
Please i need help, the error is:

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

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 & "'"
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
carlmahon

If the above statement does not work add

Response.Write(strSQL)

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
jlguerra

ASKER
oops, is my error,  sorry