- Home
·
- Active Server Pages
·
- Call this sub to populate a table, using the passed ADO Recordset and other parameters.
Call this sub to populate a table, using the passed ADO Recordset and other parameters.
Call this sub to populate a table, using the passed ADO Recordset and other parameters.
Rate Call this sub to populate a table, using the passed ADO Recordset and other parameters.
(3(3 Vote))
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
%>
Call this sub to populate a table, using the passed ADO Recordset and other parameters. Comments
No comments yet — be the first to post one!
Post a Comment