Set
Conn
=
Server.CreateObject(
"
ADODB.Connection
"
)
Connstr = " DBQ= " + server.mappath( " www/bbs.mdb " ) + " ;DefaultDir=;DRIVER={Microsoft AccessDriver(*.mdb)}; "
Conn.Open connstr
Connstr = " DBQ= " + server.mappath( " www/bbs.mdb " ) + " ;DefaultDir=;DRIVER={Microsoft AccessDriver(*.mdb)}; "
Conn.Open connstr
其中Set Conn=Server.CreateObject("ADODB.Connection")为建立一个访问数据的对象
server.mappath("www/bbs.mdb")是告诉服务器access 数据库访问的路径
2. ASP连接Sqlserver数据库语句
Set
conn
=
Server.CreateObject(
"
ADODB.Connection
"
)
conn.Open " driver={SQLServer};server=202.108.32.94;uid=wu77445;pwd=p780522;database=www_panwei_com "
conn open
conn.Open " driver={SQLServer};server=202.108.32.94;uid=wu77445;pwd=p780522;database=www_panwei_com "
conn open
其中Set conn = Server.CreateObject("ADODB.Connection")为设置一个数据库的连接对象
driver=()告诉连接的设备名是SQL-SERVER
server是连接的服务器的ip地址,Uid是指用户的用户名,pwd是指的用户的password,
database是用户数据库在服务器端的数据库的名称