一、用在ACCESS中最多
strconn = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("aspfree.mdb")
set conn = server.createobject("adodb.connection")
conn.open strconn
二、用在SQL SERVER中多
strconn = "Driver={SQL erver};Description=sqldemo;SERVER=127.0.0.1;UID=LoginID;&_
PWD=Password;DATABASE=Database_Name
set conn = server.createobject("adodb.connection")
conn.open strconn
三、用在SQL SERVER中
strconn="Driver={MicrosoftAccessDriver(*.mdb)};" &_
"DBQ=F:\Inetpub\wwwroot\somedir\db1.mdb;DefaultDir=f:\Inetpub\wwwroot\somedir;
&_ uid=LoginID;" &_
"pwd=Password;DriverId=25;FIL=MSAccess;" set conn = server.createobject("adodb.connection")
conn.open strconn
四、运用系统数据源
The following uses a Data Source Name:
set conn = server.createobject("adodb.connection")
conn.open "Example"
五、运用ODBC数据源,前提是必须在ODBC中设置数据源
set rs = server.createobject("adodb.recordset")
rs.open "tblname", "DSNName", 3, 3
strconn = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("aspfree.mdb")
set conn = server.createobject("adodb.connection")
conn.open strconn
二、用在SQL SERVER中多
strconn = "Driver={SQL erver};Description=sqldemo;SERVER=127.0.0.1;UID=LoginID;&_
PWD=Password;DATABASE=Database_Name
set conn = server.createobject("adodb.connection")
conn.open strconn
三、用在SQL SERVER中
strconn="Driver={MicrosoftAccessDriver(*.mdb)};" &_
"DBQ=F:\Inetpub\wwwroot\somedir\db1.mdb;DefaultDir=f:\Inetpub\wwwroot\somedir;
&_ uid=LoginID;" &_
"pwd=Password;DriverId=25;FIL=MSAccess;" set conn = server.createobject("adodb.connection")
conn.open strconn
四、运用系统数据源
The following uses a Data Source Name:
set conn = server.createobject("adodb.connection")
conn.open "Example"
五、运用ODBC数据源,前提是必须在ODBC中设置数据源
set rs = server.createobject("adodb.recordset")
rs.open "tblname", "DSNName", 3, 3
转载于:https://blog.51cto.com/lanou/652698