Seanus
03-15-2005, 11:32 PM
Please could someone help me - I am quite new to ASP and have a databse with urls in which I want to display on the page as a hyperlink. My code is as follows. I do not know how to get it to write an active, clickable link.
Code:
<%
'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim rsimsref 'Holds the recordset for the records in the database
Dim strSQL 'Holds the SQL query for the database
'Create an ADO connection object
Set adoCon = Server.CreateObject("ADODB.Connection")
'Set an active connection to the Connection object using a DSN-less connection
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("imsref.mdb")
'Create an ADO recordset object
Set rsimsref = Server.CreateObject("ADODB.Recordset")
'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "select referral.URL, referral.Description FROM referral;"
'Open the recordset with the SQL query
rsimsref.Open strSQL, adoCon
'Loop through the recordset
Do While not rsimsref.EOF
'Write the HTML to display the current record in the recordset
Response.Write ("</a>")
Response.Write ("<br>")
Response.write (rsimsref("URL"))
Response.Write ("</a>")
Response.Write ("<br>")
Response.Write (rsimsref("Description"))
Response.Write ("</a>")
Response.Write ("<br>")
Response.Write ("a href=""pullinfo.asp?ID="(rsimsref,"URL") & "URL")
'Move to the next record in the recordset
rsimsref.MoveNext
Loop
'Reset server objects
rsimsref.Close
Set rsimsref = Nothing
Set adoCon = Nothing
%>
Tha last response.write line is one of many that I have tried. The URLS are in a Column named URL
Please help!! :confused:
Code:
<%
'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim rsimsref 'Holds the recordset for the records in the database
Dim strSQL 'Holds the SQL query for the database
'Create an ADO connection object
Set adoCon = Server.CreateObject("ADODB.Connection")
'Set an active connection to the Connection object using a DSN-less connection
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("imsref.mdb")
'Create an ADO recordset object
Set rsimsref = Server.CreateObject("ADODB.Recordset")
'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "select referral.URL, referral.Description FROM referral;"
'Open the recordset with the SQL query
rsimsref.Open strSQL, adoCon
'Loop through the recordset
Do While not rsimsref.EOF
'Write the HTML to display the current record in the recordset
Response.Write ("</a>")
Response.Write ("<br>")
Response.write (rsimsref("URL"))
Response.Write ("</a>")
Response.Write ("<br>")
Response.Write (rsimsref("Description"))
Response.Write ("</a>")
Response.Write ("<br>")
Response.Write ("a href=""pullinfo.asp?ID="(rsimsref,"URL") & "URL")
'Move to the next record in the recordset
rsimsref.MoveNext
Loop
'Reset server objects
rsimsref.Close
Set rsimsref = Nothing
Set adoCon = Nothing
%>
Tha last response.write line is one of many that I have tried. The URLS are in a Column named URL
Please help!! :confused: