|
 |
asp_databases thread: SQL Data Retrieve
Message #1 by "chetanp" <chetanpp@h...> on Fri, 30 Nov 2001 17:16:18
|
|
i have a web page that take info about a person and billing and stored
then into a access database
once they click submit on page1 it goes to page2.asp which puts the info
into the database(both about the person and billing)...i also have a field
called ID (random long int)in the Person Table.
What i want to do is on the page2.asp take the ID(random) that was created
and copy it to the billing (ID1 field which takes long int)
The way i have the page2.asp is
<html>
<!-- #INCLUDE FILE="mystuff.asp" -->
<!-- #INCLUDE FILE="adovbs.inc" -->
<body>
<% =setid %>
<%
Dim objRec ' recordset object
Dim objRec2 ' recordset object
' create the recordset object
Set objRec = Server.CreateObject ("ADODB.Recordset")
' now open it
objRec.Open "Primary", strConnect, adOpenStatic, adLockOptimistic,
adCmdTable
objRec.AddNew
'this is in the database = this is in the form
objRec("PrimaryContact") = Request.form("PrimaryContact")
objRec("pCompany") = Request.form("pCompany")
objRec("pEmail") = Request.form("pEmail")
setid = objRec("ID")
objRec.Update
objRec.close
set objRec = nothing
Set objRec2 = Server.CreateObject ("ADODB.Recordset")
objRec2.Open "Billing", strConnect, adOpenStatic, adLockOptimistic,
adCmdTable
objRec2.AddNew
'this is in the database = this is in the form
objRec2("ID1") = setid
objRec2("BillContact") = Request.form("BillContact")
objRec2("bCompany") = Request.form("bCompany")
objRec2.Update
objRec2.close
set objRec2 = nothing
response.redirect "somepage.asp"
%>
</BODY>
</HTML>
i have tried creating a global var "setid" and assiging it to ID but this
did not work.
How can i get ID(table Primary) to copy to ID1(table billing)
Also, i would like to copy the "PrimaryContact"(form table Primary) to
PCName(field billing)
Thank you in advance
Message #2 by Sam Clohesy <sam@e...> on Fri, 30 Nov 2001 17:22:31 -0000
|
|
You can use @@identity to get the ID of the inserted rec then use that as a
variable to go into second table
Is this what you mean?
-----Original Message-----
From: chetanp [mailto:chetanpp@h...]
Sent: 30 November 2001 17:16
To: ASP Databases
Subject: [asp_databases] SQL Data Retrieve
i have a web page that take info about a person and billing and stored
then into a access database
once they click submit on page1 it goes to page2.asp which puts the info
into the database(both about the person and billing)...i also have a field
called ID (random long int)in the Person Table.
What i want to do is on the page2.asp take the ID(random) that was created
and copy it to the billing (ID1 field which takes long int)
The way i have the page2.asp is
<html>
<!-- #INCLUDE FILE="mystuff.asp" -->
<!-- #INCLUDE FILE="adovbs.inc" -->
<body>
<% =setid %>
<%
Dim objRec ' recordset object
Dim objRec2 ' recordset object
' create the recordset object
Set objRec = Server.CreateObject ("ADODB.Recordset")
' now open it
objRec.Open "Primary", strConnect, adOpenStatic, adLockOptimistic,
adCmdTable
objRec.AddNew
'this is in the database = this is in the form
objRec("PrimaryContact") = Request.form("PrimaryContact")
objRec("pCompany") = Request.form("pCompany")
objRec("pEmail") = Request.form("pEmail")
setid = objRec("ID")
objRec.Update
objRec.close
set objRec = nothing
Set objRec2 = Server.CreateObject ("ADODB.Recordset")
objRec2.Open "Billing", strConnect, adOpenStatic, adLockOptimistic,
adCmdTable
objRec2.AddNew
'this is in the database = this is in the form
objRec2("ID1") = setid
objRec2("BillContact") = Request.form("BillContact")
objRec2("bCompany") = Request.form("bCompany")
objRec2.Update
objRec2.close
set objRec2 = nothing
response.redirect "somepage.asp"
%>
</BODY>
</HTML>
i have tried creating a global var "setid" and assiging it to ID but this
did not work.
How can i get ID(table Primary) to copy to ID1(table billing)
Also, i would like to copy the "PrimaryContact"(form table Primary) to
PCName(field billing)
Thank you in advance
$subst('Email.Unsub')
Read the future with ebooks at B&N
http://service.bfast.com/bfast/click?bfmid=2181&sourceid=38934667&categoryid
=rn_ebooks
|
|
 |