p2p.wrox.com Forums

Need to download code?

View our list of code downloads.

  Return to Index  

proasp_codeclinic thread: Using the Command Object's Execute Method with Jscript

Message #1 by Bobby Johnson <bobby@s...> on Wed, 23 May 2001 09:30:31 -0700
I am attempting to use the Command Object's Execute method in jscript. The
execute seems to work but the number of records affected is not returned 
to the variable. The variable remains undefined.

I have posted this question in Beginning ASP but have yet to receive a
response in 4 days, so I hope I can get pointed in the right direction here.
I have attempted to find my own answer and have found the following articles
that seem to explain how to do it:


I have come to the conclusion that this is a limitation of jscript. But as
with most limitations there is normally a way around it. Can anyone assist
me in determine the records affected by a command object?

Code below:

<%@ language=javascript %> 
<!-- #include file="datastore.asp" --> 
<!-- metadata type="typelib" file="C:\Program Files\Common
Files\System\ado\msado15.dll" --> 
   <title>Using SQL's UPDATE Command and the ADO COmmand Object</title> 

var objComm,intNoOfRecords; 

Response.Write("<B>Harry the Ham directs Tarantino films?</b><BR>"); 
objComm.CommandText="UPDATE AllMovies SET Director = 'Harry the Ham' WHERE
Director LIKE 'Quentin Tarantino'"; 
Response.Write("This UPDATE command has affected "+intNoOfRecords+"

Response.Write("<B>Tarantino returned to his rightful place as

objComm.CommandText="UPDATE AllMovies SET Director = 'Quentin Tarantino'
WHERE Director LIKE 'Harry the Ham'"; 


Response.Write("This UPDATE command has affected "+intNoOfRecords+"


<!-- #include file="visitorcount.asp" --><br> 
<a href=showfile.asp?page=sqlupdate.asp>Want to see the code that generated
this page?</a> 




  Return to Index