The line in red does not update my table. <% CustID=Session.Contents("CustID") ProdID=Request.QueryString("ProdID") Qty=Request.QueryString("Qty") Dsc=Request.QueryString("Dsc") Ech=Request.QueryString("Ech") Shp=Request.QueryString("Shp") Set conn=Server.CreateObject("ADODB.Connection") conn.Provider="Microsoft.Jet.OLEDB.4.0" conn.Open ("c:/inetpub/wwwroot/HawksWeb/Data/WebData.mdb") Set OrderData = Server.CreateObject("ADODB.RecordSet") OrderData.ActiveConnection = conn OrderData.Open("Select OrderID From Orders where CustID='"&CustID&"'") If OrderData.RecordCount < 1 Then OrderData.Close Set OrderData = nothing conn.Execute "Insert Into Orders (CustID) Values ('"&CustID&"')" Else OrderData.Close Set OrderData = nothing End If If Qty > 0 Then Set Items = Server.CreateObject("ADODB.RecordSet") Items.ActiveConnection = conn Items.Open("Select ProdID From Cart where ProdID='"&ProdID&"' and CustId='"&CustID&"'") If Items.RecordCount < 1 Then conn.Execute "Insert Into Cart Values ('"&CustID&"','"&Qty&"','"&Dsc&"','"&ProdID&"','"&Ech&"','"&Shp&"')" Else [COLOR="Red"]conn.Execute "Update Cart Set Qty='"&Qty&"' Where ProdID='"&ProdID&"' and CustID='"&CustID&"'"[/COLOR] End If End If Items.Close Set Items = nothing Conn.Close Set conn = nothing Response.Write(RespStr) %> Code (markup): Any ideas?
Update Cart Set Qty='Qty' Where ProdID='ProdID' and CustID='CustID' Syntax of the SQL looks right to me. Also, given you didn't report a database error, that line is probably executing just fine. I'd say something else is going on in your ASP code. Maybe one of those variables is blank and its finding no lines to change. I'm not an ASP guy so I can't help you there though.
Actually at one point the variable ProdID was empty and it did something quite suprising... It wrote a new record with the missing fields empty! I have been programming since I was using paddle switches on an Imsai 8080 in'74 and while object oriented programming is a real improvement, I have noticed that while VB has remained very solid, most other languages (with the exception perhaps of Java) are filled with suprises and trap doors! I plan to pursue PHP, one can only hope that terrain is more solid, hmm? I am dissapointed to hear that you can find nothing wrong, notice the insert statement preceding, it works fine using identical syntax!
The recordcount property will return a -1 if it cannot determine the number of records. This may explain why it wrote an empty record. It has been several years since I have worked with classic ASP, but will take a look. All current work has been .NET 2.0 and 3.5 with C# and VB.NET.
The default cursor type is forward-only, which does not support the recordcount property. It will return a -1, so change the cursor to a client-side cursor.