mardi 26 septembre 2017

ASP Cannot display full contents of tables on Database - ADODB.Connection

It seems like silly question but I cannot find solution.

This implementation is display full content of each table on database using ADODB.Connection

'Display Tables'
Set rs = objConn.OpenSchema(20)
RPW("<table>")
RPW("<tr bgcolor=#888>")
    RPW("<td>Table</td>")
RPW("</tr>")

rs.MoveFirst
Do While Not rs.eof
    IF rs(3) = "TABLE" Then
        RPW("<tr bgcolor=#CCCCCC>")
        RPW("<td>" & rs(2) & "</td>")
        RPW("</tr>")
    End If
    rs.MoveNext
Loop

Call DisplayTable(objConn, objRecd, "Family")
Call DisplayTable(objConn, objRecd, "PersonalInformation")
Call DisplayTable(objConn, objRecd, "Special")
%>
</body>
</html>
<%
Function RPW(text)
    Response.Write(text)
End Function

Function DisplayTable(objconn, objrecd, table)
P2SN("Display Tables")
    RPW("</table>")
    strSQL = "SELECT * FROM " & table
    On Error Resume Next
    Set objrecd = objconn.Execute(strSQL)
    'Set objrecd.Open(strSQL), objConn

    If (objrecd.BOF And objrecd.EOF) Then
        P2SN("No Recoreds Found")
        'Response.End
    End If

    RPW("<table>")
    RPW("<tr bgcolor=#CCCCCC>")
    For Each x In objrecd.Fields
        RPW("<td>" & x.Name & "</td>")
    Next
    RPW("</tr>")
    RPW("<tr bgcolor=#CCCCCC>")
    For Each x In objrecd.Fields
        RPW("<td>" & x.Value & "</td>")
    Next
    RPW("</tr></table>")
End Function
%>

Result here:

enter image description here

But I have 8 people's information not only one.

Then I don't know what does the OpenSchema(20) mean.

Someone please help me. Thank you in advance.




Aucun commentaire:

Enregistrer un commentaire