【问题标题】:Connect accdb database using asp-classic使用 asp-classic 连接 accdb 数据库
【发布时间】:2013-04-11 15:51:47
【问题描述】:

我正在尝试使用 asp-classic 将数据库连接到我的网页。我之前使用 .mdb 文件时是成功的,但现在我有一个新的数据库,其格式为 accdb 并且需要是因为 .mdb 文件中不支持的功能。

我用于 .mdb 连接的代码完美运行。

<%@Language=VBScript %>
<%
Dim adoCon
Dim rsLogbook
Dim strSQL
Set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("DatabaseName.mdb")
Set rsLogbook = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT TableName.FieldName FROM TableName;"
rsLogbook.Open strSQL, adoCon
Response.Write ("<br>")
Response.Write (rsLogbook("FieldName"))
rsLogbook.Close
Set rsLogbook = Nothing
Set adoCon = Nothing
%>

我尝试用“accdb”替换“.mdb”,但没有成功。任何帮助表示赞赏:)

【问题讨论】:

    标签: database ms-access asp-classic


    【解决方案1】:

    ConnectionStrings.com 通常是为数据库连接寻找正确语法的一个很好的起点。

    您在哪里将“.mdb”更改为“.accdb”?您是否执行了以下操作?

    adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb, *.accdb)}; DBQ=" & Server.MapPath("DatabaseName.accdb")
    

    编辑:

    查看错误(“Microsoft OLE DB Provider for ODBC Drivers error '80004005'”)后,这篇知识库文章似乎可以解释问题和解决方法:http://support.microsoft.com/kb/926939

    【讨论】:

    • adoCon.Open "DRIVER={Microsoft Access Driver (*.accdb)}; DBQ=" & Server.MapPath("DatabaseName.accdb") 取出".mdb"
    • 我将代码更改为您的答案并上传到测试站点
    • 当我使用 IIS 时的文章,我没有,但我最终尝试了它,但仍然没有运气:(
    猜你喜欢
    • 1970-01-01
    • 2015-01-16
    • 1970-01-01
    • 2011-09-17
    • 1970-01-01
    • 2018-02-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多