CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 Update more than one record with custom script

Print topic Send  topic

Author Message
Waspman

Posts: 948
Posted: 02/01/2011, 11:49 AM

Got this:

Dim SQL
Dim Conn1

Set Conn1 = New clsDBConnection1
Conn1.Open

SQL ="UPDATE orders SET Despatched=1 where
cart_session_id="&Request.QueryString("cartID")

Conn1.Execute(SQL)
Conn1.Close
Set Conn1 = Nothing


Only updates on record. How can I make it update all records that meet the criteria?

Thanks.
_________________
http://www.waspmedia.co.uk
View profile  Send private message
Waspman

Posts: 948
Posted: 02/02/2011, 6:23 AM

now I've got this...

Dim conn1
Dim SQL1
Dim SQL2
Dim r

Set conn1 = New clsDBConnection1
conn1.Open
SQL1 = "SELECT cart_session_id FROM orders"
Set r = conn1.Execute(SQL1)
Do While Not r.EOF

SQL2 ="UPDATE orders SET Despatched=1 where cart_session_id=K74Xbvc"

Conn1.Execute(SQL2)


r.MoveNext
Loop


It works but it will only work if I make the where specific to the record id so it has to say

SQL2 ="UPDATE orders SET Despatched=1 where orderID=74"

Any help would be appreciated

_________________
http://www.waspmedia.co.uk
View profile  Send private message
Waspman

Posts: 948
Posted: 02/02/2011, 7:58 AM

Forgot how hard/easy ASP is. This is how ya do it :-D


DBConnection1.Execute ("UPDATE orders SET Despatched=1, item_despatched = '"& orders1.Despatched.Value &"' where cart_session_id='"&Request.QueryString("cartID")) &"'"

_________________
http://www.waspmedia.co.uk
View profile  Send private message
Waspman

Posts: 948
Posted: 02/03/2011, 11:54 AM

Spoke too soon...

Got this but it doesn't work!!!!!


DBConnection1.Execute ("UPDATE orders SET item_approved=1, item_approved_date= '"& cart.cart_approved_date.Value &"' WHERE RSM =('" & Session("TMSCUserID") & "') and (cart_session_id='"&Request.QueryString("cartID")&"')")
_________________
http://www.waspmedia.co.uk
View profile  Send private message
Waspman

Posts: 948
Posted: 02/04/2011, 12:48 AM

Given it up as a bad job and done it with CCS custom update. I've not had these kind of problems for over 2 years. That's when I switched to PHP and the frustration went away haha...
_________________
http://www.waspmedia.co.uk
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.