日本三级片在线观看视频_西西大胆午夜人体视频无码_少妇无码一区二区_亚洲天堂超碰_极品少妇被猛的白浆直流_91精品云霸高清中文字幕_草草五月天伊人_久久少妇无码专区_欧美激欧美啪啪5老太_日韩在线在线成人

幫助中心 >  技術(shù)知識(shí)庫(kù) >  數(shù)據(jù)庫(kù) >  相關(guān)技術(shù)支持 >  網(wǎng)站程序中常見(jiàn)的數(shù)據(jù)庫(kù)連接方法

網(wǎng)站程序中常見(jiàn)的數(shù)據(jù)庫(kù)連接方法

2009-11-30 14:07:26 10973

我們整理出四種常用的access連接方式,當(dāng)然,第1種這是最常用的(推薦使用)。
1.
set dbconnection=Server.CreateOBJECT("ADODB.CONNECTION")
DBPath = Server.MapPath("customer.mdb") //customer.mdb是您的數(shù)據(jù)庫(kù)名,您可以在前面加上路徑
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 (該項(xiàng)僅適用于獨(dú)立主機(jī)用戶,虛擬主機(jī)不支持?jǐn)?shù)據(jù)源)
set conn=server.createobject("Adodb.connection")
conn.open "DSN=xxx;UID=;PWD=;Database=customer

SQL數(shù)據(jù)庫(kù)
conn="Driver={SQL Server};Server=數(shù)據(jù)庫(kù)服務(wù)器名稱或者數(shù)據(jù)庫(kù)IP地址;Database=數(shù)據(jù)庫(kù)名;UID=登錄用戶名;PWD=登錄密碼"
Access數(shù)據(jù)庫(kù)
conn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&server.mappath("數(shù)據(jù)庫(kù)名.mdb")

提交成功!非常感謝您的反饋,我們會(huì)繼續(xù)努力做到更好!

這條文檔是否有幫助解決問(wèn)題?

非常抱歉未能幫助到您。為了給您提供更好的服務(wù),我們很需要您進(jìn)一步的反饋信息:

在文檔使用中是否遇到以下問(wèn)題: