Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: Dreamweaver MX: update command not updating when it ought to!


Message #1 by "Gianpiero Colagiacomo" <gp@1...> on Tue, 18 Feb 2003 22:32:27 +0100
I have an ASP/Javascript page with a command updating an 'orders'
table in my access database.  Trouble is the update doesn't update the
table...  The sql generated works fine if I run it in access so I have to
assume that the command execution is not happening.  There are no errors
generated however...

Here's the command :

<%
if(String(Status) != "undefined"){ updateOrder__stat = String(Status);}

if(String("Authorised") != "undefined"){ updateOrder__detail 
String("Authorised");}

if(String(VPSTxID) != "undefined"){ updateOrder__ptxID = String(VPSTxID);}

if(String(TxAuthNo) != "undefined"){ updateOrder__auth = String(TxAuthNo);}

if(String(VendorTxCode) != "undefined"){ updateOrder__orderid 
String(VendorTxCode);}

%>
<%
var updateOrder = Server.CreateObject("ADODB.Command");
updateOrder.ActiveConnection = MM_jgcollection_STRING;
updateOrder.CommandText = "UPDATE Orders  SET status = '"+
updateOrder__stat.replace(/'/g, "''") + "', StatusDetail = '"+
updateOrder__detail.replace(/'/g, "''") + "', protxid = '"+
updateOrder__ptxID.replace(/'/g, "''") + "', authno = '"+
updateOrder__auth.replace(/'/g, "''") + "' , OrderType = 1  WHERE ID = "+
updateOrder__orderid.replace(/'/g, "''") + " ";
updateOrder.CommandType = 1;
updateOrder.CommandTimeout = 0;
updateOrder.Prepared = true;
updateOrder.Execute();
Response.Write(updateOrder.CommandText);
%>

The response.write generates the following:

UPDATE Orders SET status = 'OK', StatusDetail = 'Authorised', protxid 
'{00000033-12C7-0001-0000-19812679E635}', authno = '29970' , OrderType = 1
WHERE ID = 176

As I say, no errors are reported and the above sql updates the correct row
properly in access so I'm stumped as to why the row is not being updated by
the page itself!  How can I check to see whether the Execute worked or not
in the actual page (is there something I can response.write that will tell
me the status of the execution request for example)?




Message #2 by "Ken Schaefer" <ken@a...> on Wed, 26 Feb 2003 14:36:02 +1100
The Command object's .Execute() method has a parameter for the
NumberOfRecordsAffected by the statement. It should be 1 if 1 record was
updated:

<%
objCommand.Execute intRecsAffected

Response.Write(intRecsAffected & " record(s) were affected")
%>

Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Gianpiero Colagiacomo" <gp@1...>
Subject: [access_asp] Dreamweaver MX: update command not updating when it
ought to!


: I have an ASP/Javascript page with a command updating an 'orders'
: table in my access database.  Trouble is the update doesn't update the
: table...  The sql generated works fine if I run it in access so I have to
: assume that the command execution is not happening.  There are no errors
: generated however...
:
: Here's the command :
:
: <%
: if(String(Status) != "undefined"){ updateOrder__stat = String(Status);}
:
: if(String("Authorised") != "undefined"){ updateOrder__detail 
: String("Authorised");}
:
: if(String(VPSTxID) != "undefined"){ updateOrder__ptxID = String(VPSTxID);}
:
: if(String(TxAuthNo) != "undefined"){ updateOrder__auth 
String(TxAuthNo);}
:
: if(String(VendorTxCode) != "undefined"){ updateOrder__orderid 
: String(VendorTxCode);}
:
: %>
: <%
: var updateOrder = Server.CreateObject("ADODB.Command");
: updateOrder.ActiveConnection = MM_jgcollection_STRING;
: updateOrder.CommandText = "UPDATE Orders  SET status = '"+
: updateOrder__stat.replace(/'/g, "''") + "', StatusDetail = '"+
: updateOrder__detail.replace(/'/g, "''") + "', protxid = '"+
: updateOrder__ptxID.replace(/'/g, "''") + "', authno = '"+
: updateOrder__auth.replace(/'/g, "''") + "' , OrderType = 1  WHERE ID = "+
: updateOrder__orderid.replace(/'/g, "''") + " ";
: updateOrder.CommandType = 1;
: updateOrder.CommandTimeout = 0;
: updateOrder.Prepared = true;
: updateOrder.Execute();
: Response.Write(updateOrder.CommandText);
: %>
:
: The response.write generates the following:
:
: UPDATE Orders SET status = 'OK', StatusDetail = 'Authorised', protxid 
: '{00000033-12C7-0001-0000-19812679E635}', authno = '29970' , OrderType = 1
: WHERE ID = 176
:
: As I say, no errors are reported and the above sql updates the correct row
: properly in access so I'm stumped as to why the row is not being updated
by
: the page itself!  How can I check to see whether the Execute worked or not
: in the actual page (is there something I can response.write that will tell
: me the status of the execution request for example)?
:
:
:
:
:


  Return to Index