<% '---------------------------------参数设置
Function Get_Access_Conn(FileName,Password)
dim str
on error resume next
str= "Provider=Microsoft.Jet.OLEDB.4.0;"
str=str& "Data Source=" &server.MapPath(FileName)&";Jet OLEDB:Database Password="&Password
Set Get_Access_Conn= Server.CreateObject("ADODB.Connection")
Get_Access_Conn.Open str
if err.number<>0 then
Set Get_Access_Conn=nothing
Get_Access_Conn="error"
end if
End Function
function checkFileExist(filename)
dim objFSO
checkFileExist=false
set objFSO=Server.CreateObject("Scripting.FileSystemObject")
if objFSO.FileExists(server.MapPath(filename)) then
checkFileExist=true
end if
set objFSO=nothing
end function
Function Get_Conn()
on error resume next
err.clear
if checkFileExist("admin/include/sub/check.mdb") then
path="admin/include/sub/"
elseif checkFileExist("include/sub/check.mdb") then
path="include/sub/"
elseif checkFileExist("check.mdb") then
path=""
elseif checkFileExist("../include/sub/check.mdb") then
path="../include/sub/"
elseif checkFileExist("../../include/sub/check.mdb") then
path="../../include/sub/"
end if
filename=path&"check.mdb"
pwd=base64decode(base64decode("WjNWdmVYVnhhV0Z1Wnc9PQ=="))
Set Get_Conn=Get_Access_Conn(filename,Pwd)
if err.number<>0 then
Response.Write "<script language=javascript>"
Response.Write "alert('不能打开数据库!');"
'Response.Write "window.history.back(1);"
Response.Write "</script>"
response.End()
end if
End Function
function CloseConn(cn)
if IsObject(Session(cn)) then
Session(cn).close
set Session(cn) =nothing
end if
session.Contents.Remove(cn)
end function
If IsObject(Session("Conn")) and Not IsNull(Session("Conn") ) Then
Set Conn = Session("Conn")
Else
Set Conn =Get_Conn()
Session("Conn") = Conn
end if
Function Get_Rs(conn,sql,CursorType,LockType)
on error resume next
Set Get_Rs= Server.CreateObject("ADODB.Recordset")
Get_Rs.Open sql, conn,CursorType,LockType
if err.number<>0 then
response.write sql&"<br>"
response.write err.description
response.End()
end if
end Function
%>