0
votes

Im trying to connect a database to my webpage using asp-classic. I was successful before when i was using a .mdb file but now i have a new database that is in the format of accdb and needs to be because of a feature that is not supported in the .mdb file.

The code i used for the .mdb connection that worked perfectly.

<%@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
%>

I tried replacing the ".mdb" with "accdb" but no luck. Any help is appreciated :)

1

1 Answers

1
votes

ConnectionStrings.com is usually a pretty good place to start when looking for the right syntax for a database connection.

Where did you change ".mdb" to ".accdb"? Did you do the following?

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

Edit:

After viewing the error ("Microsoft OLE DB Provider for ODBC Drivers error '80004005'") it seems like this KB Article might explain the issue and workaround: http://support.microsoft.com/kb/926939