MS Access数据库连接
用DSN连接并且没有用户名和密码
<%
set conn = ServerCreateObject(ADODBConnection)
connopen YourDSNName
%>
用DSN连接并且有用户名和密码
<%
set conn = ServerCreateObject(ADODBConnection)
connopen YourDSNNameusernamepassword
%>
用实际的数据库绝对路径连接
<%
Set conn = ServerCreateObject(ADODBConnection)
Strconn=DRIVER={Microsoft Access Driver (*mdb)};
Strconn=Strconn & DBQ=e:\yanhang\databasemdb
connOpen Strconn
%>
用实际的数据库相对路径连接
<%
Set conn = ServerCreateObject(ADODBConnection)
Strconn=DRIVER={Microsoft Access Driver (*mdb)};
Strconn=Strconn & DBQ= & ServerMapPath(/database/yanhangmdb)
connOpen Strconn
%>
MS SQL Server数据库连接
用DSN连接
<%
set conn = ServerCreateObject(ADODBConnection)
connopen DSN=MyDSN;UID=user;PWD=password;DATABASE=databasename
%>
不用DSN连接
<%
Set conn = ServerCreateObject(ADODBConnection)
DSNtemp=DRIVER={SQL Server};SERVER=ServerName;UID=USER;PWD=password;DATABASE=databasename
connopen DSNtemp
%>
FoxPro数据库连接
<%
Set Conn = ServerCreateObject(nnection)
ConnStr= Driver=Microsoft Visual Foxpro Driver; UID=userID;SourceType=DBC;SourceDB=C:\yanhang\databasedbc
ConnOpen ConnStr
%>
Oracle数据库连接
<%
set conn=servercreateobject(nnection)
conncursorlocation=adUseClient
DSNTemp=Provider=MSDAORA;Password=xxxxx;User ID=yanhang;Data Source=xxxworld
connopen DSNtemp
%>