Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: 80040e0c - Command Text was not set for the command object


Message #1 by "Ryan Beazley" <ryan.beazley@d...> on Mon, 17 Sep 2001 16:26:43
I need help.  Whenever I try to submit data for updating the database I 

get the (80040e0c Command text was not set for the command object)error.  

Here is the code in question.



The "if reset.bof and..." line, is the line reported.



'Check to see if the employee entering data has done so before

If recset.bof and recset.eof then conn.execute (SQLEMP)

		

if action="add" then

	'Generate SQL statements - SQLEMP (employee entry) & SQLAGENCY 

(agency entry)

	SQLEMP="INSERT INTO employee (emp_name, emp_nbr, mail_code, 

input_date) VALUES ("

	SQLEMP=SQLEMP & "'" & emp_name & "',  "

	SQLEMP=SQLEMP & "'" & emp_nbr & "',  "

	SQLEMP=SQLEMP & "'" & mail_code & "', "

	SQLEMP=SQLEMP & "'" & input_date & "')"



Anyone have any ideas?
Message #2 by "Zimmer Computer Consulting" <zee@t...> on Mon, 17 Sep 2001 13:24:51 -0700
Could you show your conection open and your recordset open? The problem may

be in there.





----- Original Message -----

From: Ryan Beazley <ryan.beazley@d...>



> I need help.  Whenever I try to submit data for updating the database I

> get the (80040e0c Command text was not set for the command object)error.



> Here is the code in question.

>

> The "if reset.bof and..." line, is the line reported.

>

> 'Check to see if the employee entering data has done so before

> If recset.bof and recset.eof then conn.execute (SQLEMP)

>

> if action="add" then

> 'Generate SQL statements - SQLEMP (employee entry) & SQLAGENCY

> (agency entry)

> SQLEMP="INSERT INTO employee (emp_name, emp_nbr, mail_code,

> input_date) VALUES ("

> SQLEMP=SQLEMP & "'" & emp_name & "',  "

> SQLEMP=SQLEMP & "'" & emp_nbr & "',  "

> SQLEMP=SQLEMP & "'" & mail_code & "', "

> SQLEMP=SQLEMP & "'" & input_date & "')"





Message #3 by "Ryan Beazley" <ryan.beazley@d...> on Mon, 17 Sep 2001 22:08:12
Here it is.  Thanks for the help.



'SQL statement to retrieve a record for an employee who has entered data 

before

EMPCHECK="SELECT emp_nbr FROM employee WHERE emp_nbr='"

EMPCHECK= EMPCHECK & emp_nbr & "'"



'Create a database connection named conn & execute the EMPCHECK statement

'Load the resulting recordset into a variable called recset

set conn = server.createobject ("ADODB.Connection")

conn.open "resource"

set recset = conn.execute (EMPCHECK)



'Check to see if the employee entering data has done so before

If recset.bof and recset.eof then	conn.execute (SQLEMP)

		

if action="add" then

	'Generate SQL statements - SQLEMP (employee entry) & SQLAGENCY 

(agency entry)

	SQLEMP="INSERT INTO employee (emp_name, emp_nbr, mail_code, 

input_date) VALUES ("

	SQLEMP=SQLEMP & "'" & emp_name & "',  "

	SQLEMP=SQLEMP & "'" & emp_nbr & "',  "

	SQLEMP=SQLEMP & "'" & mail_code & "', "

	SQLEMP=SQLEMP & "'" & input_date & "')"



> Could you show your conection open and your recordset open? The problem 

may

> be in there.

> 

> 

> ----- Original Message -----

> From: Ryan Beazley <ryan.beazley@d...>

> 

> > I need help.  Whenever I try to submit data for updating the database I

> > get the (80040e0c Command text was not set for the command object)

error.

> 

> > Here is the code in question.

> >

> > The "if reset.bof and..." line, is the line reported.

> >

> > 'Check to see if the employee entering data has done so before

> > If recset.bof and recset.eof then conn.execute (SQLEMP)

> >

> > if action="add" then

> > 'Generate SQL statements - SQLEMP (employee entry) & SQLAGENCY

> > (agency entry)

> > SQLEMP="INSERT INTO employee (emp_name, emp_nbr, mail_code,

> > input_date) VALUES ("

> > SQLEMP=SQLEMP & "'" & emp_name & "',  "

> > SQLEMP=SQLEMP & "'" & emp_nbr & "',  "

> > SQLEMP=SQLEMP & "'" & mail_code & "', "

> > SQLEMP=SQLEMP & "'" & input_date & "')"

> 

> 

Message #4 by "Zee Computer Consulting" <zee@t...> on Mon, 17 Sep 2001 19:56:03 -0700
Try setting the command type of the connection object:



    Conn.CommandType = adCmdText

    set recset = conn.execute EMPCHECK



or



    set recset = conn.execute EMPCHECK, RecordsAffectedCount, adCmdText



and adCmdText is defined in adovbs.inc or you can use:



    adCmdText = 1



Does this help?





--Zee





----- Original Message -----

From: "Ryan Beazley" <ryan.beazley@d...>

To: "Access ASP" <access_asp@p...>

Sent: Monday, September 17, 2001 10:08 PM

Subject: [access_asp] Re: 80040e0c - Command Text was not set for the

command object





> Here it is.  Thanks for the help.

>

> 'SQL statement to retrieve a record for an employee who has entered data

> before

> EMPCHECK="SELECT emp_nbr FROM employee WHERE emp_nbr='"

> EMPCHECK= EMPCHECK & emp_nbr & "'"

>

> 'Create a database connection named conn & execute the EMPCHECK statement

> 'Load the resulting recordset into a variable called recset

> set conn = server.createobject ("ADODB.Connection")

> conn.open "resource"

> set recset = conn.execute (EMPCHECK)

>

> 'Check to see if the employee entering data has done so before

> If recset.bof and recset.eof then conn.execute (SQLEMP)

>

> if action="add" then

> 'Generate SQL statements - SQLEMP (employee entry) & SQLAGENCY

> (agency entry)

> SQLEMP="INSERT INTO employee (emp_name, emp_nbr, mail_code,

> input_date) VALUES ("

> SQLEMP=SQLEMP & "'" & emp_name & "',  "

> SQLEMP=SQLEMP & "'" & emp_nbr & "',  "

> SQLEMP=SQLEMP & "'" & mail_code & "', "

> SQLEMP=SQLEMP & "'" & input_date & "')"

>

> > Could you show your conection open and your recordset open? The problem

> may

> > be in there.

> >

> >

> > ----- Original Message -----

> > From: Ryan Beazley <ryan.beazley@d...>

> >

> > > I need help.  Whenever I try to submit data for updating the database

I

> > > get the (80040e0c Command text was not set for the command object)

> error.

> >

> > > Here is the code in question.

> > >

> > > The "if reset.bof and..." line, is the line reported.

> > >

> > > 'Check to see if the employee entering data has done so before

> > > If recset.bof and recset.eof then conn.execute (SQLEMP)

> > >

> > > if action="add" then

> > > 'Generate SQL statements - SQLEMP (employee entry) & SQLAGENCY

> > > (agency entry)

> > > SQLEMP="INSERT INTO employee (emp_name, emp_nbr, mail_code,

> > > input_date) VALUES ("

> > > SQLEMP=SQLEMP & "'" & emp_name & "',  "

> > > SQLEMP=SQLEMP & "'" & emp_nbr & "',  "

> > > SQLEMP=SQLEMP & "'" & mail_code & "', "

> > > SQLEMP=SQLEMP & "'" & input_date & "')"

> >

> >

>




>



Message #5 by "Ryan Beazley" <ryan.beazley@d...> on Tue, 18 Sep 2001 14:42:00
The first one returned error "Object doesn't support named arguments: 

conn.CommandType'



The second one returns the same error I had before on the same line.



You know what's funny.  From what I hear this was working before I had to 

reload the server.  Could this be a ASP version issue?  This got dropped 

in my lap whenever the designer left.  I've been learning for all of a 

couple of weeks.



Our server is running NT4 with IIS3 and MDAC2.5 (I think).  All of our 

other databases seem to work fine.  Queries and Updates.



Let me know if you need any other info.



Thanks again for the help.



Ryan

> Try setting the command type of the connection object:

> 

>     Conn.CommandType = adCmdText

>     set recset = conn.execute EMPCHECK

> 

> or

> 

>     set recset = conn.execute EMPCHECK, RecordsAffectedCount, adCmdText

> 

> and adCmdText is defined in adovbs.inc or you can use:

> 

>     adCmdText = 1

> 

> Does this help?

> 

> 

> --Zee
Message #6 by "Zee Computer Consulting" <zee@t...> on Tue, 18 Sep 2001 10:58:07 -0700
Hopefully you are running IIS4 or later on your NT4 (with Service Pack 6)

server. I installed  ADO version 2.6 -- MDAC 2.6 SP1 (2.61.7326.6). It is

possible you have an earlier version of ADO. You might try downloading the

latest MDAC package from http://ww.microsoft.com/data .



If you had to reload your server, it has probably reverted back to an

earlier version of MDAC.



-- Zee





----- Original Message -----

From: "Ryan Beazley" <ryan.beazley@d...>

To: "Access ASP" <access_asp@p...>

Sent: Tuesday, September 18, 2001 2:42 PM

Subject: [access_asp] Re: 80040e0c - Command Text was not set for the

command object





> The first one returned error "Object doesn't support named arguments:

> conn.CommandType'

>

> The second one returns the same error I had before on the same line.

>

> You know what's funny.  From what I hear this was working before I had to

> reload the server.  Could this be a ASP version issue?  This got dropped

> in my lap whenever the designer left.  I've been learning for all of a

> couple of weeks.

>

> Our server is running NT4 with IIS3 and MDAC2.5 (I think).  All of our

> other databases seem to work fine.  Queries and Updates.

>

> Let me know if you need any other info.

>

> Thanks again for the help.

>

> Ryan

> > Try setting the command type of the connection object:

> >

> >     Conn.CommandType = adCmdText

> >     set recset = conn.execute EMPCHECK

> >

> > or

> >

> >     set recset = conn.execute EMPCHECK, RecordsAffectedCount, adCmdText

> >

> > and adCmdText is defined in adovbs.inc or you can use:

> >

> >     adCmdText = 1

> >

> > Does this help?

> >

> >

> > --Zee




>



Message #7 by "Ryan Beazley" <ryan.beazley@d...> on Wed, 19 Sep 2001 03:37:44
I finally figured it out.  It had to do with someone "fixing" so to speak, 

my database.  I went in and changed the field properties back to wat they 

were and it started working.  Then I had to move some asp code around to 

make the page function properly, but it works.  Or it did until we got 

nailed by W32.Nimda.



Thanks for all the help.  I really appreciate your time.



Ryan Beazley
Message #8 by "Charles Mabbott" <aa8vs@m...> on Thu, 20 Sep 2001 20:57:04 -0400
The formats for Insert I found not to be very forgiving, your statement g

ave me some ideas to try, but here is what I used for insert into....



objComm.CommandText =3D "INSERT INTO Members(Fname, lname, callid, class,

 renew) VALUES ( ' " & strfname & " ', ' " & strlname & " ' , ' " & strca

ll & " ', ' " & strclass & " ', ' " & strdate & " ')"

Chuck  

 

----- Original Message -----

From: Zimmer Computer Consulting

Sent: Monday, September 17, 2001 6:24 PM

To: Access ASP

Subject: [access_asp] Re: 80040e0c - Command Text was not set for the com

mand object

 

Could you show your conection open and your recordset open? The problem m

ay

be in there.





----- Original Message -----

From: Ryan Beazley <ryan.beazley@d...>



> I need help.  Whenever I try to submit data for updating the database I

> get the (80040e0c Command text was not set for the command object)error

.



> Here is the code in question.

>

> The "if reset.bof and..." line, is the line reported.

>

> 'Check to see if the employee entering data has done so before

> If recset.bof and recset.eof then conn.execute (SQLEMP)

>

> if action=3D"add" then

> 'Generate SQL statements - SQLEMP (employee entry) & SQLAGENCY

> (agency entry)

> SQLEMP=3D"INSERT INTO employee (emp_name, emp_nbr, mail_code,

> input_date) VALUES ("

> SQLEMP=3DSQLEMP & "'" & emp_name & "',  "

> SQLEMP=3DSQLEMP & "'" & emp_nbr & "',  "

> SQLEMP=3DSQLEMP & "'" & mail_code & "', "

> SQLEMP=3DSQLEMP & "'" & input_date & "')"








  Return to Index