Jump to content

passing an SQL value through a link using ASP


theAntiGeek

Recommended Posts

hey everyone.this question is kinda like my last post in that its fairly simple as i can do it in coldfusion but i just cant figure it out in ASP.I need to take the value (topic) of this SQL statement:"SELECT topic FROM blogentrys"and put it into this link so it is passed to another page.heres what i have for the link so far but it isnt retrieving the value of "topic" from the SQL statement, i know this because i display the variable on the next page and no value is displayed, only the name.Response.Write("<a href='blogpost.asp?mytopic='"& rs.Fields.Item("topic").Value&"'>" + x.value + "<" + "/a>" + "<br" + "/><br" + "/>")any help much appreciated. cheers

Link to comment
Share on other sites

cheers pulp. i tried that but it still isnt getting the value of the SQL query.heres what i have:<% dim val set conn=Server.CreateObject("ADODB.Connection") conn.Provider="Microsoft.Jet.OLEDB.4.0" conn.Open "D:/Inetpub/wwwroot/finesplice/htdocs/webdata/dbblog.mdb" set rs=Server.CreateObject("ADODB.recordset") rs.Open "SELECT topic FROM blogentrys", conn do until rs.EOF for each x in rs.Fields val = rs.Fields.Item("topic").Value Response.Write("<a href='blogpost.asp?mytopic='" + val + ">" + x.value + "<" + "/a>" + "<br" + "/><br" + "/>") next Response.Write("<br />") rs.MoveNext loop rs.close conn.close %>can you see why the value of "topic" isnt being passed on?

Link to comment
Share on other sites

Try this...<%dim val set conn=Server.CreateObject("ADODB.Connection")conn.Provider="Microsoft.Jet.OLEDB.4.0"conn.Open "D:/Inetpub/wwwroot/finesplice/htdocs/webdata/dbblog.mdb"set rs=Server.CreateObject("ADODB.recordset")rs.Open "SELECT topic FROM blogentrys", conndo until rs.EOFfor each x in rs.Fieldsval = rs.Fields.Item("topic").ValueResponse.Write("<a href=active.asp?mytopic=" + val + ">" + x.value + "<" + "/a>" + "<br" + "/><br" + "/>") nextResponse.Write("<br />")rs.MoveNextlooprs.closeconn.close%>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...