by Yuening Dai (30 Submissions)
Category: Active Server Pages
Compatability: ASP (Active Server Pages)
Difficulty: Unknown Difficulty
Originally Published: Wed 18th October 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Call this sub to populate a table, using the passed ADO Recordset and other parameters.
Sub CreateTable(objRst,intBorder,strCaption)
' This sub can be modified to have more functions such as specifying column width, hiding
' fields, change field titles, aligning cell contents and so on.
Dim strWriteLine
strWriteLine = "<TABLE BORDER=" & CStr(intBorder) & " COLS=" & CStr(objRst.Fields.Count) & ">"
Response.Write strWriteLine
strWriteLine="<CAPTION ALIGN=center>" & strCaption & "</Caption>"
Response.Write strWriteLine
Response.Write "<TR>"
For Each objFld In objRst.Fields
strWriteLine = "<TH>" & objFld.Name & "</TH>"
Response.Write strWriteLine
Next
Response.Write "</TR>"
objRst.MoveFirst
Do While Not objRst.EOF
Response.Write "<TR>"
For Each objFld In objRst.Fields
Response.Write "<TD ALIGN=RIGHT>"
If IsNull(objFld) Then
Response.Write " "
Else
Response.Write objFld.Value
End If
Response.Write "</TD>"
Next
objRst.MoveNext
Response.Write "</TR>"
Loop
Response.Write "</TABLE>"
End Sub
%>
No comments have been posted about Call this sub to populate a table, using the passed ADO Recordset and other parameters.. Why not be the first to post a comment about Call this sub to populate a table, using the passed ADO Recordset and other parameters..