1.SQL Server
<%
cstr = "Provider=SQLOLEDB;Server=<ip address>;database=<dbname>;"
cstr = cstr & ".network=DBMSSOCN;uid=<uid>;pwd=<pwd>"
set conn = server.createobject("adodb.connection")
conn.open cstr
@# 利用Network=DBMSSOCN方式连接可以避免管理命名引起的错误
%>
2.Oracle
<%
cstr = "Provider=OraOLEDB.Oracle;Server=<ip address>;Data "
cstr = cst & "Source=<dbname>;User ID=<uid>;Password=<pwd>"
set conn = server.createobject("adodb.connection")
conn.open cstr
%>
3. Access
<%
cstr = "Driver={Microsoft Access Driver (*.mdb)};DBQ="
cstr = cstr & server.mappath("/<pathtofile.mdb>")
set conn = server.createobject("adodb.connection")
conn.open cstr
%>
4.如果你安装了Jet 4.0,用这种方法连接效果更好.
<%
cstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
cstr = cstr & server.mappath("/<pathtofile.mdb>")
set conn = server.createobject("adodb.connection")
conn.open cstr
%>
文章来源于领测软件测试网 https://www.ltesting.net/