首页 > 开发 > 综合 > 正文

数据库连接范例

2024-07-21 02:10:56
字体:
来源:转载
供稿:网友


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"
%>
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表