ASP与各种关系数据库的连接方式- -
时间:2006-08-17 来源:muzhouren
1. set conn = server.CreateObject("adodb.connection")
conn.open "DBQ="&server.mappath("data/data.mdb")&";Driver={Microsoft Access Driver (*.mdb)};"
2. set conn = server.CreateObject("adodb.connection")
conn.open "Data Source="&server.mappath("data/data.mdb")&";Provider=Microsoft.Jet.Oledb.4.0;"
与SQLSERVER数据库连接:
'注:下文中的snowxf为数据库名,根据自己需要随意取的,localhost为服务器的名称或IP地址
1. set conn = server.CreateObject("adodb.connection")
conn.open "Provider=SQLOLEDB;Data Source=snowxf;UID=用户名;PWD=密码;"
1. set conn = server.CreateObject("adodb.connection")
conn.open "Driver={SQL Server};UID=用户名;PWD=密码;DATABASE=localhost;"
与ORACLE数据库连接:
1.set conn = server.CreateObject("adodb.connection")
conn.Open "Driver={Microsoft ODBC for Oracle};Server=cctm.workgroup;Uid=;Pwd="
2.set conn = server.CreateObject("adodb.connection")
conn.Open "Provider=MSDAORA;Persist Security Info=True;UID=;PWD=;Data Source=cctm.workgroup"
与ACCESS数据库连接:
1. set conn = server.CreateObject("adodb.connection")
conn.open "DBQ="&server.mappath("data/data.mdb")&";Driver={Microsoft Access Driver (*.mdb)};"
2. set conn = server.CreateObject("adodb.connection")
conn.open "Data Source="&server.mappath("data/data.mdb")&";Provider=Microsoft.Jet.Oledb.4.0;"
与SQLSERVER数据库连接:
'注:下文中的snowxf为数据库名,根据自己需要随意取的,localhost为服务器的名称或IP地址
1. set conn = server.CreateObject("adodb.connection")
conn.open "Provider=SQLOLEDB;Data Source=snowxf;UID=用户名;PWD=密码;"
1. set conn = server.CreateObject("adodb.connection")
conn.open "Driver={SQL Server};UID=用户名;PWD=密码;DATABASE=localhost;"
与ORACLE数据库连接:
1.set conn = server.CreateObject("adodb.connection")
conn.Open "Driver={Microsoft ODBC for Oracle};Server=cctm.workgroup;Uid=;Pwd="
2.set conn = server.CreateObject("adodb.connection")
conn.Open "Provider=MSDAORA;Persist Security Info=True;UID=;PWD=;Data Source=cctm.workgroup"