Jul 04 2001

DSN-less OLEDB

Posted by admin under ADO database

ADO can be used via ODBC or OLEDB drivers. OLEDB drivers generally gives somewhat better performance.

<%
Function Incdb_GetConnectionString( nNumber )
    Incdb_GetConnectionString = "Provider=Microsoft.Jet.OLEDB.3.51;Data Source=" & Server.MapPath("\database\ad2000.mdb")
End Function
%>


This code uses version 3.51 of the Access OLEDB driver to connect to the database. There is a newer ( and better/faster) version called 4.0 as well. That driver can however only be used to connect to Access 2000 database files, not Access 97 files, so, use this table to work the version problem out: ( the database file is called db.mdb and is located under the /database/ directory )

Access file version Connect string Result
97 "Microsoft.Jet.OLEDB.3.51;Data Source=" & Server.MapPath("\database\db.mdb) OK
2000 "Microsoft.Jet.OLEDB.3.51;Data Source=" & Server.MapPath("\database\db.mdb) OK
97 "Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("\database\db.mdb) Unrecognized database format 'I:\webs\webshop\admentor\admentorlive.mdb'.
2000 "Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("\database\db.mdb) OK