<!--#include file="sql.asp"-->
<%
response.buffer=true
%>
<%
dim conn
dim connstr
dim db:db="data/data.mdb"
'设定数据名称
dim dbset:setdb =1
'设定连接类型
set conn = server.createobject("adodb.connection")
select case setdb
case "1"
connstr="provider=microsoft.jet.oledb.4.0;data source=" & server.mappath(""&db&"")
case "2"
connstr="driver={microsoft access driver (*.mdb)};dbq=" & server.mappath(""&db&"")
case "3"
connstr="driver={sql server};server=localhost;uid=sa;pwd=123;database=pw_sys_data"
case else
connstr= "dns=pw_sys_data"
end select
if err.number<>0 then
err.clear
set conn=nothing
response.write "数据库连接出错!"
response.end
else
conn.open connstr
if err then
err.clear
set conn=nothing
response.write "数据库连接出错!"
response.end
end if
end if %>