HTML on a web page. However, I was able to modify some code posted here from Jonax (
http://p2p.wrox.com/topic.asp?TOPIC_ID=4138) that does 95% of what I want. The only thing I need now is to figure out how to provide a delimited list of fields that I used in the select clause to not display in the HTML output, but still be available to use as part of the hyperlink.
Code:
<%
Dim ReportSDate
Dim ReportEDat
ReportSDate = Request.Form("StartDate")
ReportEDate = Request.Form("EndDate")
Session("ReportStartDate") = ReportSDate
Session("ReportEndDate") = ReportEDate
%>
<%
'Procedure to create a table
sub MakeTable(SourceIn, sLinkURL, iIdField, sLinkFields)
dim Field, objField, bLinkIt, t
dim aLinkFields
aLinkFields = split(lcase(sLinkFields),",")
Set oRSmtr = Server.CreateObject("ADODB.Recordset")
oRSmtr.ActiveConnection = conn
oRSmtr.Open SourceIn
response.write "<table border=0><tr>"
For Each Field in oRSmtr.Fields
response.write "<th>" & Field.name & "</th>"
next
'response.end
Do while not oRSmtr.EOF
response.write "<tr>"
For each objField in oRSmtr.fields
bLinkIt = FALSE
for t = 0 to ubound(aLinkFields,1)
if aLinkFields(t) = lcase(objField.name) then
bLinkIt = TRUE
exit for
end if
next
if bLinkIt = TRUE then
response.write "<td><a href='" & sLinkURL & oRSmtr.fields(iIdField) & "'>" & objField.value & "</a> </td>"
else
response.write "<td>" & objField.value & " </td>"
end if
Next
oRSmtr.movenext
response.write "</tr>"
loop
response.write "</table>"
oRSmtr.close
set oRSmtr=nothing
end sub
%> </p>
<%call MakeTable("SELECT field1, field2, field3, field4, field4 FROM table WHERE stuff", "./somepage.asp?ID=", 0, "field1")%>
</p>