1、连接access数据库的常用方法
dim conn
dim db
dim connstr
db="数据库的名称" '如/data/data.mdb
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.MapPath(db)
set conn=Server.CreateObject("ADODB.Connection")
conn.open connstr
2、连接sql数据库的常用方法
dim username
dim password
dim DatabaseName
dim HostIP
Username = "sa" 'SQL数据库用户名
Password = "123456" 'SQL数据库用户密码
DatabaseName = "v6081208" 'SQL数据库名
HostIP = "(local)"
ConnStr = "Provider = Sqloledb; User ID = " & Username & "; Password = " & Password & "; Initial Catalog = " & DatabaseName & "; Data Source = " & HostIP & ";"
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.open ConnStr
3、连接excel数据库的常用方法
dim myConnection
dim myConn_Xsl
set myConnection=server.createobject("adodb.connection")
myConn_Xsl="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &strName& ";Extended Properties=Excel 8.0"
myconnection.open myConn_Xsl
4、连接mysql数据库的常用方法
dim adocon
set adocon=Server.Createobject("adodb.connection")
adocon.open"Driver={mysql};database=yourdatabase;uid=username;pwd=yourpassword;option=16386;"
5、连接Oracle数据库的常用方法
dim adocon
set adocon=Server.Createobject("adodb.connection")
adocon.open"Driver={microsoft odbc for oracle};server=oraclesever.world;uid=admin;pwd=pass;"