I did not understand the correct HTML structure (in what format data will come in the columns ?). Anyway, check whether the following logic will help.
Dim iNumCols
iNumCols = 3
Dim arrContent(3)
qry="SELECT <field_list> FROM table"
set rs = objConn.Execute(qry)
if(not(rs.Eof or rs.Bof))
arrContent(1)=""
arrContent(2)=""
arrContent(3)=""
rs.MoveFirst
While(not(rs.Eof))
'formulate the piece of HTML corresponding to this record. Let that be stored in a variable strContent.
If(rs("row")>=1 and rs("row")<=10) Then
arrContent(1)=arrContent(1) & strContent
else if(rs("row")>=11 and rs("row")<=20) Then
arrContent(2)=arrContent(2) & strContent
else if(rs("row")>=21 and rs("row")<=30) Then
arrContent(3)=arrContent(3) & strContent
end if
rs.MoveNext
Wend
Dim iLoop
Response.Write "<table class=""<class for table>""><tr>" & vbcrlf
for iLoop = 1 to iNumCols
Response.Write "<td class=""<class for column>"">" & arrContent(iLoop) & "</td>" & vbcrlf
next
Response.Write "</tr></table>"
end if
When the number of columns change you need to add more else if blocks. You have to change the iNumCols and the array subscription.
|