28,391
社区成员
发帖
与我相关
我的任务
分享
<%
Class DB
public Conn
public ConnStr
public ErrStr
Private Sub class_Initialize()
set Conn = server.CreateObject("adodb.connection")
End Sub
Private Sub class_Terminate()
Close()
End Sub
Function Open()
if conn.state=0 then
on error resume next
for each ConnStr in C_ConnArr
'response.Write ConnStr & "<br>"
Conn.connectionstring = ConnStr
Conn.open()
if Conn.State then exit for
next
end if
End Function
Function Close()
if conn.state=1 then
conn.close()
end if
End Function
Function ExecQ(SqlStr)
Call Exec(SqlStr,0,1)
End Function
Function ExecR(SqlStr)
set ExecR = Exec(SqlStr,0,1)
End Function
Function ExecS(SqlStr)
Dim tempRs
set tempRs = ExecR(SqlStr)
if not tempRs.eof then
ExecS = tempRs(0)
else
ErrStr = ""
end if
set tempRs = Nothing
End Function
Function ExecW(SqlStr)
set ExecW = Exec(SqlStr,1,2)
End Function
Function Exec(SqlStr,Cursor_Type,Lock_Type)
Dim f_rs
Open()
set f_rs = server.CreateObject("adodb.recordset")
if session("SqlNum")="" then
session("SqlNum") =1
else
session("SqlNum") = session("SqlNum") + 1
end if
'response.Write conn.connectionstring
'response.Write conn.state
'response.Write SqlStr & "<br>"
if TypeName(SqlStr)<>"String" then SqlStr = SqlStr '调用SqlSelect 的默认方法返回Sql语句
f_rs.open SqlStr,conn,Cursor_Type,Lock_Type,&H0001
set Exec = f_rs
End Function
End Class
%>