Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Record - Query

Status
Not open for further replies.

aspmonster

IS-IT--Management
Dec 11, 2003
25
US
I am trying to carry over one record from page1 to page 2.
I am not sure if I can use querystring or otherwise..
This is a portion of my code.
Page 1
============
<!--Where I use my field as a hyperlink to carry over -->
<td><A href=&quot;msaccess_form_test.asp?id= <%=rs(&quot;Company&quot;)%> &quot;><%=rs(&quot;Company&quot;)%></a></td>
============
Page 2
===========
<!--The SQL Query on Page 2 -->
<%

Dim rs, strSQL, tbl, Market, MP
Set conn = Server.CreateObject(&quot;ADODB.Connection&quot;)
conn.open &quot;driver={Microsoft Access Driver (*.mdb)};dbq=db\tr_courses.mdb&quot;
set rs = server.CreateObject(&quot;ADODB.Recordset&quot;)
strSQL = &quot;Select * From VIPWebReport WHERE Company = &quot;
strSQL = strSQL & &quot; ORDER BY District, Company&quot;
rs.open strSQL,conn,3,2
%>
<!--Where record is displayed -->
<input name=&quot;courseid_form&quot; size=&quot;30&quot; value=&quot;<%=rs(&quot;Company&quot;)%>&quot; disabled>
===========

Please help..I am not sure if I am doing anything wrong..
If anyone can give links to any examples where record is carried from one page to other..from a beginner - intermediate level of asp..that would be great too..
 
Hi,

Here is what you need to add on page 2:


dim myCompany
myCompany = request.querystring(&quot;id&quot;)


your SQL statement then needs to be like this:


strSQL = &quot;Select * From VIPWebReport
strSQL = strSQL & &quot;WHERE Company = '&quot; & myCompany & &quot;'&quot;
strSQL = strSQL & &quot; ORDER BY District, Company&quot;


this statement above will pull all the info you want based on the company that was clicked on on page 1.

now you want to display your record:


<input name=&quot;courseid_form&quot; size=&quot;30&quot; value=&quot;<% = myCompany %>&quot; disabled>


This will display the Company Name (or whatever value this holds) that was carried over from page 1. This does not, however, display any other information that you might want from your database.

So simply put, in your page 2, you need to call the variable via a querystring request.

I hope this helps. Let me know if you need more...

J~
 
Thanks a million for your help.
Just let me confirm the following before I pick the code..

I believe I have to add all this code in the top (before <HTML>)
dim myCompany
myCompany = request.querystring(&quot;id&quot;)


your SQL statement then needs to be like this:


strSQL = &quot;Select * From VIPWebReport
strSQL = strSQL & &quot;WHERE Company = '&quot; & myCompany & &quot;'&quot;
strSQL = strSQL & &quot; ORDER BY District, Company&quot;


And then in the <Body> where I want my records displayed

<input name=&quot;courseid_form&quot; size=&quot;30&quot; value=&quot;<% = myCompany %>&quot; disabled>

Now..as I am calling all the elements in the table (Select *)..I can call all the fields if I want in the <body> right...?

Also please confirm if the coding I had done for Page 1 is correct...
And if I have multiple records displayed on Page 1 each with an hyperlink..this same code would work...?
Thanks..waiting eagerly for your response
 
Chappi,
Is there an email id ..where I can mail you the entire code(with the db)..maybe you can help me better that way...
I tried what you said and it didnt work for me..so I am sure..there is something else missing..
Let me know..
I would be helped in a great way..if this can be done..

Its actually a very important and job sensitive asp application...
Thanks..
Asp Monster...!!!
 
No problem. Email your code to jeannette@cbs-inc.net.

J~
 
Thanks Jeannette
I will do that from home..as you know..I can't mail work stuff from a work email ..
I am sure..u can fix my problem..in a sec...
Have a great Friday..and great weekend...

Would you like to post techie articles on my website..
I know..it doesnt get that many hits..
But just as an expert..if you can..then you are more than welcome...

I am currently working on a new version right now..hope to launch it back for Christmas...
Thanks a million again..

Take care..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top