Morpheusweb.it - Risorse per webmaster: script, ASP.NET, C#, Visual Basic .Net, tutorial, asp, javascript, css, php, html, java, ADO, VBScript, forms, frames, Active Server Pages, Dynamic HTML, database, gratis per webmaster e webdesigner

Recordset into a table

It allows to insert the data coming from a recordset in a table of which it is possible to specify the number of the columns.


<%
Dim objConn, objRS, strSQL
Set objConn =Server.CreateObject("ADODB.Connection")
objConn.Open strConn
strSQL = "SELECT * FROM [myTable]"
Set objRS = Server.CreateObject("ADODB.Recordset") objRS.Open strsql, objConn, 1
strTOTrecord = objRS.RecordCount
' set the columns to show
colsNum = 5
rest = (strTOTrecord mod colsNum)
partRecords = ((strTOTrecord - rest) / colsNum )
Response.Write "<table border='1' align='center'>"
for n = 1 to partRecords
  Response.Write "<tr>"
  ' print records
  for m =1 to colsNum
    Response.Write "<td>" & objRS("collezione") & "</td>"
    objRS.MoveNext
  next
  Response.Write "</tr>"
next
Response.Write "</table>"
if rest <> "0" then
  Response.Write "<table border='1' align='center'><tr>"
  for f = 1 to rest
    Response.Write "<td>"&objRS("collezione")&"</td>"
    objRS.MoveNext
  next
  Response.Write "</tr></table>"
end if
' clear objects
objRS.Close
Set objRS = Nothing
objConn.Close
Set objConn = Nothing
%>


Download code...


Print this page


 

Inizio pagina

risorse per webmaster