<%
dim conn
dim connstr
dim db
'以下为Access连接
db="\DataBase\#DataBase.mdb"     '数据库文件的位置
'strConn="Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath(db)

'以下为MS SQL连接
'strConn.open"driver={sql server};server=(local);uid=owen;pwd=owen;database=000"

'连接数据库
on error resume next
strConn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.MapPath(db)
set conn=server.createobject("ADODB.CONNECTION")
conn.open strConn
If Err Then
response.Write "连接数据库出错!"
err.Clear
Set conn = Nothing
Response.End
End If
%>