This topic is locked

Pass Paremeter

10/23/2006 12:51:23 PM
ASPRunnerPro General questions
T
tgunther author

I am using ASP Runner 4.0 and i recently asked how to pass a parameter from a header page to a detail page. This question was answered by using the follwing code

Sub AfterAdd()

str = "select @@IDENTITY from dbo.header"

Set rsTemp = server.CreateObject("ADODB.Recordset")

rsTemp.open str, dbConnection
Session("foreignkey") = rsTemp(0)



This worked fine, but now I am trying to make it so that once a header record is added it takes you directly to a detial record add page for the header that was just added. I attempted to use the following code:

Response.Redirect "Detail_add.asp?editid=&editid2=&editid3=&TargetPageNumber=1&todo=add&masterkey=Session("foreignkey")"



Unfortunately it does not work and gives me an error when I attempt to even open the header list page. Can you please help?

Sergey Kornilov admin 10/23/2006

Try this:

Response.Redirect "Detail_add.asp?editid=&editid2=&editid3=&TargetPageNumber=1&todo=add&masterkey=" & Session("foreignkey")
T
tgunther author 10/23/2006

Try this:


Response.Redirect "Detail_add.asp?editid=&editid2=&editid3=&TargetPageNumber=1&todo=add&masterkey=" & Session("foreignkey")


The link works and I do not get an error unfortunately it does not tranfer the key field over so when I add the detail record it adds it to my database but it does not link it to the header file. Also I currently have Session("foreignkey") as my default value for the key field on my detail table, using a microsoft sql server. Any thoughts? Thanks for the help, it is greatly appreciated.

Sergey Kornilov admin 10/23/2006