CodeCharge Studio
search Register Login  

Web Reports

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

YesSoftware Forums -> Archive -> GotoCode Archive

 Completely Lost

Print topic Send  topic

Author Message
Nick
Posted: 04/16/2003, 6:21 PM

I am trying to modify the Bookstore Example and can not understand how to create an Invoice and InvoiceItem record that carry the same InvoiceID.

I have gone through the help on determining and using an SQL Server primary key but it will not work for me.

This is what I have any help would be appreciated. On a PrepareCheckout page I have a button with a purchase button, on the page open Event I have the following code.

if GetParam("param")= "purchase" then

sSQLinsert = "insert into invoices (invoiceid, customerid) select order_id, customerid from orders where customerid = " & Session("UserID")
cn.execute sSQLinsert

pkSQL = "select @@identity as lastpk from Invoices where Invoices.InvoiceID =@@identity"
openrs rs, pkSQL
last = GetValue(rs, "lastpk")
session(“lastpk”) = last

sSQLcopy = "insert into InvoiceItems (invoiceid, customerid, item_id, quantity) select order_id, customerid, item_id, quantity from orders where customerid = " & Session("UserID")
cn.execute sSQLcopy

sSQLdel = "delete from Orders where customerID= " & Session("UserID")
cn.execute SSQLdel

response.redirect "ThankYou.asp"
end if

I have no idea how to use the Identity key or any values on the form in inserts.

Thank you in advance
hamilton
Posted: 04/25/2003, 8:09 AM

Provide email and I'll be in touch
Nick Jones
Posted: 04/25/2003, 1:49 PM

Thank you for your response but I finally worked it out.

Great product when you get past the basic learning curve.

Thanks again
Nick
RipCurl
Posted: 04/25/2003, 5:28 PM

Would you both mind in posting what codes you modified. Since the bookstore example is "almost" obsolete, there are many of those who would like to get an idea on how to start modding it for their usage.

   


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.