首页 > 开发 > 综合 > 正文

数据库连接范例

2024-07-21 02:30:35
字体:
来源:转载
供稿:网友
OLE DB Method for SQL
<%
set cnn = server.createobject("ADODB.Connection")
cnn.open "PROVIDER=SQLOLEDB;DATA SOURCE=sqlservername;UID=username;PWD=passWord;DATABASE=databasename "
%>

DSN Less connection for access
<%
set cnn = server.createobject("ADODB.Connection")
cnn.open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=c:/anydatabase.mdb"
%>

OLE DB Method for Access
<%
set cnn = server.createobject("ADODB.Connection")
cnn.open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=c:/anydatabase.mdb"
%>

File DSN Connection Method for Access
<% set cnn = server.createobject("ADODB.Connection")
cnn.open "FILEDSN=AccessDSN"
%>

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表