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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing database values through hyperlinks

Status
Not open for further replies.

csiwa28

Programmer
Apr 12, 2001
177
I just started developing in ASP and I have some questions that I can't find answers to online and I am looking for help.

I have a database with a table - Product

Name Type
Product A Type A
Product A Type B
Product B Type A

My first asp page will read from the database and list all the products as hyperlinks. Then when the user clicks on a hyperlink, then a second page will display the different types of that product.

My question is how do I pass a value from a hyperlink? Here's what I have so far.

Dim objRec
Set objRec = Server.CreateObject ("ADODB.Recordset")objRec.Open "Product",strConnect,adOpenStatic,adLockReadOnly,adCmdTable

'loop through the products table
Response.Write &quot;Select Product Type:<BR>&quot;
While Not objRec.EOF
Response.Write &quot;<a href= type.asp>&quot; & objRec(&quot;Name&quot;) & &quot;</a>&quot; & &quot;<BR>&quot;

objRec.MoveNext
Wend
 
I do it with QueryStrings - like this...

<a href=&quot;type.asp?<%=&quot;NAME=&quot; & objRec(&quot;NAME&quot;)%>&quot;>


Type.asp then includes a suitable SQL query selecting * from product where name = request.querystring(&quot;NAME&quot;)

Or something like that.

Cheers
Sarah
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top