locked
How to output the whole table from sql server RRS feed

  • Question

  • User1864490474 posted

    Thanks for your help about the authentication. Now, I would like to display the whole table in database but I don't know how to achieve this while the classic asp seems doesn't have something like greed view in asp.net. So is there anyone could help me achieve this? Thanks in advance.

    Tuesday, May 16, 2017 2:02 PM

Answers

  • User-460007017 posted

    Hi JeffryRock,

    Here is the sample to display the column with header in classic asp.

    <!DOCTYPE html>
    <html>
    <body>
    
    <%
    set conn=Server.CreateObject("ADODB.Connection")
    conn.Provider="Microsoft.Jet.OLEDB.4.0"
    conn.Open(Server.Mappath("/db/northwind.mdb"))
    set rs = Server.CreateObject("ADODB.recordset")
    sql="<query string>"
    rs.Open sql, conn
    %>
    
    <table border="1" width="100%">
    <tr>
    <%for each x in rs.Fields
        response.write("<th>" & x.name & "</th>")
    next%>
    </tr>
    <%do until rs.EOF%>
        <tr>
        <%for each x in rs.Fields%>
           <td><%Response.Write(x.value)%></td>
        <%next
        rs.MoveNext%>
        </tr>
    <%loop
    rs.close
    conn.close
    %>
    </table>
    
    </body>
    </html>

    If you need to display the whole field, you could define multiple column. I'm afraid there is no kind of greedview in classic asp.

    https://www.w3schools.com/asp/showasp.asp?filename=demo_display3

    Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. 

    Microsoft does not control these sites and has not tested any software or information found on these sites;

    Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there.

    There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

    Best Regards,

    Yuk Ding

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Wednesday, May 17, 2017 6:15 AM