歷史記錄 - ASP 讀取 .mdb 語法

 

此篇只是記錄 N 年前玩過的 ASP 語法,

至於此範例還能不能動作,現在也已經不重要了。

Default.asp

<%
    set conn=Server.CreateObject("ADODB.Connection")
    conn.Provider="Microsoft.Jet.OLEDB.4.0"
    conn.Open "C:\inetpub\MyTest\Project14.mdb"
    set rs=Server.CreateObject("ADODB.recordset")
    rs.Open "select * from Sales", conn
    '讀取所有資料
    do while not rs.eof
    '讀取一列資料
        for each x in rs.fields
            response.write(x.name)
            response.write(" = ")
            response.write(x.value)
            response.write(";")
        next		
        response.write("<br>")
        rs.movenext
    loop
%>

 

web.config

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <httpErrors errorMode="Detailed" />
    </system.webServer>
</configuration>