theAntiGeek Posted June 27, 2006 Share Posted June 27, 2006 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 More sharing options...
pulpfiction Posted June 27, 2006 Share Posted June 27, 2006 Just to make it simple, get the DB value in a variable and use that in the URLdim val val = rs.Fields.Item("topic").ValueResponse.Write("<a href='blogpost.asp?mytopic='" + Val + ">" + x.value + "<" + "/a>" + "<br" + "/><br" + "/>") Link to comment Share on other sites More sharing options...
theAntiGeek Posted June 27, 2006 Author Share Posted June 27, 2006 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 More sharing options...
pulpfiction Posted June 27, 2006 Share Posted June 27, 2006 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 More sharing options...
theAntiGeek Posted June 27, 2006 Author Share Posted June 27, 2006 thank you pulp that is working now!now if you just want to give me your bank details i shall pur some money your account for you Link to comment Share on other sites More sharing options...
pulpfiction Posted June 27, 2006 Share Posted June 27, 2006 Glad could help you.... Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now