ASP连接Access数据库
写的的ASP程序上传到服务器上出现了以下问题:
“Microsoft OLE DB Provider for ODBC Drivers 错误 '80004005' 由于系统错误 126 (Microsoft Access Driver (*.mdb)),指定驱动程序无法加载”
在连数据库时用的是下面的第一种方法,以网上找资料,说是要安装“mdac”,但是服务器上
又不能随便在上面安装东西,后来在同事的提醒下使用了第二种方法,结果问题解决了。
1.
set dbconnection=Server.CREATEOBJECT("ADODB.CONNECTION")
DBPath = Server.MapPath("customer.mdb")
dbconnection.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath
SQL="select * from auth where id="" & user_id &"""
SET uplist=dbconnection.EXECUTE(SQL)
2.
set dbconnection=Server.CreateObject("ADODB.Connection")
DBPath = Server.MapPath("customer.mdb")
dbconnection.Open "provider=microsoft.jet.oledb.4.0;data source="&dbpath
SQL="select * from auth where id="" & user_id &"""
SET uplist=dbconnection.EXECUTE(SQL)
3.
DBPath = Server.MapPath("customer.mdb")
set session("rs")=Server.CreateObject("ADODB.Recordset")
" rs=Server.CreateObject("ADODB.Recordset")
connstr="provider=microsoft.jet.oledb.4.0;data source="&dbpath
SQL="select * from auth where id="" & user_id &"""
session("rs").Open sql,connstr,1,3
4.
建odbc源xxx
set conn=server.createobject("Adodb.connection")
conn.open "DSN=xxx;UID=;PWD=;Database=customer