Passing Autonumber (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


xterradane -> Passing Autonumber (1/2/2002 21:42:49)

I need to submit a form and then use the Access Autonumber to be passed to the next page, I guess as NewPage.asp?ID=

But, how do I code it to get the id after adding? I tried using the following, but I must be doing something wrong:

rsJob.Update
NewID=rsJob(0)

Dim strName, strValue
For each strField in rsJob.Fields
strName = strField.Name
strValue = strField.Value
Session(strName) = strValue
Next
Session("blnValidUser") = True
rsJob.Close
Set rsJob=Nothing
Response.Clear
Response.Redirect "Invoice.asp?ID='&NewID&'"

Thanks,
Gail

 




Spooky -> RE: Passing Autonumber (1/2/2002 21:53:39)

Whats the rest of the DB code?

§þððk¥
Database / DRW Q & A
VP-ASP Shopping cart
Spooky Login




xterradane -> RE: Passing Autonumber (1/2/2002 22:00:08)

<%
Dim rsJob
Set rsJob = Server.CreateObject("ADODB.Recordset")
rsJob.Open "Job", objConn, adOpenForwardOnly, adLockOptimistic, adCmdTable

rsJob.AddNew
rsJob("EMail") = Session("EMail")
rsJob("JobType") = Request.Form("JobType")
rsJob("JobTitle") = Request.Form("JobTitle")
rsJob("Education") = Request.Form("Education")
rsJob("Certification") = Request.Form("Certification")
rsJob("JobDescription") = Request.Form("JobDescription")
rsJob("Experience") = Request.Form("Experience")
rsJob("PayRange") = Request.Form("PayRange")
rsJob("Benefits") = Request.Form("Benefits")
rsJob("City") = Request.Form("City")
rsJob("State") = Request.Form("State")
rsJob("Country") = Request.Form("Country")
rsJob("ApplicantInstructions") = Request.Form("ApplicantInstructions")
rsJob("DatePosted") = Date
rsJob("DateExpires") = Date + Request.Form("DaysPosted")
rsJob.Update
NewID=rsJob(0)

Dim strName, strValue
For each strField in rsJob.Fields
strName = strField.Name
strValue = strField.Value
Session(strName) = strValue
Next
Session("blnValidUser") = True
rsJob.Close
Set rsJob=Nothing
Response.Clear
Response.Redirect "Invoice.asp?ID='&NewID&'"
%>


 




Spooky -> RE: Passing Autonumber (1/3/2002 2:14:09)

Try these options :

adOpenKeySet, adLockPessimistic, adCmdTable

Also, dont use Response.Clear and see how you go.

§þððk¥
Database / DRW Q & A
VP-ASP Shopping cart
Spooky Login




xterradane -> RE: Passing Autonumber (1/3/2002 10:56:38)

Ok, I've done that and now it goes to the next page, adds to database, but in just passes this code: webpub/Invoice.asp?ID='&NewID&' Rather than the ID #, Do I have a quote wrong or something?

 




Mojo -> RE: Passing Autonumber (1/3/2002 11:09:35)

Try:

Response.Redirect "Invoice.asp?ID="&NewID

Joe







Spooky -> RE: Passing Autonumber (1/3/2002 13:11:38)



§þððk¥
Database / DRW Q & A
VP-ASP Shopping cart
Spooky Login




xterradane -> RE: Passing Autonumber (1/3/2002 13:16:30)

Thanks, that worked great!

 




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
5.859375E-02