3 回答
TA贡献1799条经验 获得超6个赞
其实就是去掉server就可以了.
比如 connstr="DBQ=db.mdb;DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
Set conn=CreateObject("ADODB.CONNECTION") '这里只是去掉server,照样可以连接
conn.open connstr
'连接试试看
set rs=createobject("Adodb.RecordSet")
sql="select * from news"
rs.open sql,conn,1,1
do while not rs.eof
msgbox rs("title")'这里是循环输出标题,vbs能用msgbox弹出.
rs.movenext
loop
rs.close
conn.close
set rs=nothing
set conn=nothing
msgbox "完毕"
TA贡献1784条经验 获得超9个赞
Dim conn,rs,sqlstr
Set conn = CreateObject("ADODB.Connection")
conn.connectionstring = "provider=microsoft.jet.oledb.4.0;data source="F:/datebase/11.mdb""
conn.open
TA贡献1757条经验 获得超8个赞
ASP连接Access<%
dim conn,mdbfile
mdbfile=server.mappath("数据库名称.mdb")
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};uid=admin;pwd=数据库密码;dbq="&mdbfile
%>
添加回答
举报