<% @Language = "VBScript" %> <% '---------------------------------------------------------------------------------------- '- ASP dbList - Version 8.1 - 30 July 2005 '- Copyright © 2005 - Livio Siri (http://www.livio.net) - All Rights Reserved. '---------------------------------------------------------------------------------------- Option Explicit Response.Buffer = True Dim Q Dim sDSN Dim Conn, k, h, RS, field, s, t Q = request.querystring("Q") Session.LCID = 1040 sDSN = Request.querystring("dsn") 'response.write Q & "
" 'response.end %> Stampa Archivio <% '--- Main ' On error resume next GR(sDSN) Response.write "" Response.write "" '---------------------------------------------------- Function GR(sDSN) Dim cnnGetRows Dim rstGetRows Dim arrDBData Dim arrDBFields Dim I, J Dim iRecFirst, iRecLast Dim iFieldFirst, iFieldLast Dim sValue Dim strDBFields, Wmax Dim field Set cnnGetRows = Server.CreateObject("ADODB.Connection") cnnGetRows.Open sDSN Set rstGetRows = cnnGetRows.Execute(Q) '--- show field names in the table header------------------------------------------------- Response.Write "" '--- loop through the fields in the recordset i = 0 for each field in rstGetRows.Fields ArrDBFields = ArrDBFields & field.name & " " i = i + 1 next strDBFields = Split(arrDBFields," ") Wmax = ubound(strDBFields) For i = 0 to Wmax Response.Write "" next Response.write "" Response.write "" On error resume next arrDBData = rstGetRows.GetRows() rstGetRows.Close Set rstGetRows = Nothing cnnGetRows.Close Set cnnGetRows = Nothing iRecFirst = LBound(arrDBData, 2) iRecLast = UBound(arrDBData, 2) iFieldFirst = LBound(arrDBData, 1) iFieldLast = UBound(arrDBData, 1) '--- Loop through the records (second dimension of the array) For I = iRecFirst To iRecLast Response.Write "" '--- A table row for each record Response.Write "" & vbCrLf '--- Loop through the fields (first dimension of the array) For J = iFieldFirst To iFieldLast '--- A table cell for each field If ISNULL(arrDBData(J, I)) Then Response.Write "" & vbCrLf Else sValue = Server.HTMLEncode(arrDBData(J, I)) sValue = replace(sValue, CHR(13), "
") Response.Write "" & vbCrLf End if Next ' J Response.Write "" & vbCrLf Next ' I Response.Write "
" Response.write strDBFields(i) Response.Write "
 " & sValue & "
" & vbCrLf End Function %>