|
-
Feb 12th, 2001, 01:32 PM
#1
Thread Starter
Hyperactive Member
Hi everyone!
I hope you enloyed your weekend. My newbie questions is this:
If I assign data to a variable in one page using ASP/ADO, can I use that same variable(with the data) on another asp page? If so, is there any specific code I need to have/use?
I hope this question isn't confusing. Thanks in advance.
-vbuser1976 
VB6 Enterprise SP6
SQL 7.0 SP2
VBScript, HTML, Javascript, C++, a little UNIX
-
Feb 12th, 2001, 04:40 PM
#2
New Member
Hidden Fields / Session Variables
You can use hidden fields on a form and then use the Request.Form("fldID") (this is using a post on the form action) to get the values or you can pass it in the querystring using a get and then use the Request.Querystring("fldID"). If you want to use session variables I can't site code for you. I stay away from session variables due to scaleability, expiration and corruption issues.
-
Feb 12th, 2001, 05:04 PM
#3
Thread Starter
Hyperactive Member
okay, but...
Yeah, I kind of of guessed that. But, here's my problem:
I am running a search on a html form that jumps to an asp page with an HTML table with all the results. At the end of each row of records (sorted by ID) there are two links. The first link lets the user go to another ASP page to edit the record. The second link lets the user go to another ASP page (different than the first) to just view the entire record data. How do I go about doing this?
Thanks again in advance.
-vbuser1976 
VB6 Enterprise SP6
SQL 7.0 SP2
VBScript, HTML, Javascript, C++, a little UNIX
-
Feb 12th, 2001, 05:26 PM
#4
New Member
Maybe I have got it now. You have two Hyperlinks that you want to build dynamically based on some data. If this is correct I would go with the option of embedding the data you need to pass to either page in the URL. You do this by appending a question mark "?" and then as many ID=Value pairs as needed to deliver the data to the ASP Page. Here is an example
http:/some.url.com/yourpage.asp?Field1=Data1&Field2=Data2.
I do this exclusively in a site I wrote for an on-line Insurance quote engine. The reason I did this is because some pages did not use a form so I could not use hidden fields. I used a QueryString that I built at run-time and I found it quit easy to pass values around pages this way. The other benefit is that the solution is more scalable than if I used session variables, and I did not need to worry about session expiration either. If you would like an example take a look at the site HTTP://www.cycledirect.com. This will give you an example from the users’ perspective. If you would like I can send you some of the ASP code I used to generate this page.
I hope I am understanding your question and therefor responding with something that will help you. If not let me know and I can pursue another avenue with this. As you know IIS/ASP has about a 100 ways to solve the same problem.
-
Feb 13th, 2001, 01:10 AM
#5
Junior Member
The best way to go about this is to attached the record ID or pointer to your destination url as querystring and retrieve this id. Query the record and display/edit it. You don't even need a separate page for editing and viewing. You could pass a parameter for the mode (i.e. edit=0, edit=1)
example:
<a href="/editpage.asp?ID=yourrecordidhere">Edit</a>
<a href="/viewpage.asp?ID=yourrecordidhere">View</a>
Note that editpage and viewpage can be one page.
retrieve the record id by using the ff:
dim RecordID
RecordID = Request.QueryString("ID")
Your statement would be:
"SELECT * FROM MyTable WHERE RecordID = '" & RecordID & "'"
query it....display it....do as you please....
Share your knowledge, it is the best way to achieve immortality
-
Feb 14th, 2001, 08:30 AM
#6
Thread Starter
Hyperactive Member
Thanks!
Thanks Eclipse & usejwat, that was what I was looking for.
-vbuser1976 
VB6 Enterprise SP6
SQL 7.0 SP2
VBScript, HTML, Javascript, C++, a little UNIX
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|