access 数据连接程序
发布时间:2015-06-05 来源:查字典编辑
摘要:DimconnSubDBOpen()Dimdb:db=Server.MapPath(”zzz.mdb”)Setcon...
Dim conn
Sub DBOpen()
Dim db : db=Server.MapPath(”zzz.mdb”)
Set conn=Server.CreateObject(”Adodb.Connection”)
On Error Resume Next
conn.Open “Provider=Microsoft.Jet.OLEDB.4.0;Data Source=” & db
If Err.Number<>0 then
Err.Clear
Response.Write(”<h1>The Database link is ERROR</h1>”)
Response.End()
End If
On Error GoTo 0
End Sub
Call DBOpen()
… …
conn.CLose() : Set conn=Nothing