• 自适应输出表格(ASP版)


    <%
    '
    '
        Made by Goodspeed
    '
    '
        
    Option Explicit 
    Response.Buffer 
    = True
    'sql数据库连接参数:数据库名、用户密码、用户名、连接名(本地用local,外地用IP)
    Const SqlUsername = "sa"
    Const SqlPassword = "qwe"
    Const SqlDatabaseName = "NorthWind"
    Const SqlLocalName = "127.0.0.1"
    Dim ConnStr

    ConnStr 
    = "Provider = Sqloledb; User ID = " & SqlUsername & "; Password = " & SqlPassword & "; Initial Catalog = " & SqlDatabaseName & "; Data Source = " & SqlLocalName & ";"

    '打开数据库
    Dim Conn
    Set Conn=server.createobject("adodb.connection")
    Conn.Open ConnStr
    %
    >
    <html>
    <head>
        
    <title>ASP Test</title>
        
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    </head>
    <body>
    <table>
    <%
    Dim rs, strSQL, Field, strResponse

    strSQL 
    = "SELECT EmployeeID,LastName,FirstName FROM Employees;"
    Set rs = Conn.Execute(strSQL)


    '输出表头
    strResponse = "<tr>"
    For Each Field In rs.Fields
        strResponse 
    = strResponse & "<td>" & Field.Name & "</td>"
    Next
    strResponse 
    = strResponse & "</tr>"

    '输出表体
    Do Until rs.EOF
        strResponse 
    = strResponse & "<tr>"

        For Each Field In rs.Fields
            strResponse 
    = strResponse & "<td>" & rs(Field.Name)  & "</td>"
        Next
        
        strResponse 
    = strResponse & "</tr>"
        rs.MoveNext
    Loop
    Set rs = nothing
    Response.Write (strResponse)
    %
    >
    </table>
    </body>
    </html>
    <%
    Conn.Close()
    Set Conn = nothing
    %
    >
  • 相关阅读:
    QML的默认属性default property
    QtCreator下QML翻译
    QML开发常见错误(原)
    qt下的跨目录多工程编译(转)
    git使用笔记
    osgQt支持触摸屏
    Qt资源整理ING
    Visual assint x(转)
    C#开发重用方法
    UDP问题
  • 原文地址:https://www.cnblogs.com/goodspeed/p/32675.html
Copyright © 2020-2023  润新知