当前位置:首页 >> 虚拟主机FAQ >> 如何连接ACCESS数据库? 虚拟主机FAQ

如何连接ACCESS数据库?

作者:零点网络 发表时间:2009-9-24 21:47:03 阅读:

本站整理出四种常用的access连接方式,当然,第1种这是最常用的(推荐使用)。
1.
set dbconnection=Server.CREATEOBJECT("ADODB.CONNECTION")
DBPath = Server.MapPath("customer.mdb") //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 (该项在本站仅适用于MSSQL)
set conn=server.createobject("Adodb.connection")
conn.open "DSN=xxx;UID=;PWD=;Database=customer

网站地图 /   关于我们 /   服务流程 /   售后服务 /   版权声明 /   免责声明 /   人才招聘 /   付款方式 /   联系我们
版权所有 © 2006- 零点网络工作室 保留所有版权    鄂ICP备06005235号
办公地址:深圳福田区深南中路2018号兴华大厦10楼    邮政编码:518000
咨询电话:13631579250    电子邮箱:sales@code168.net