Sub DeleteObject(ByRef obj)
Set obj = nothing
obj = null
End Sub
Class CDB
private m_oConn
private m_pageIndex
private strError
private m_QueryString
private Sub Class_Initialize()
m_oConn = null
m_oRS = null
m_pageIndex =
m_pageSize =
m_pageCount =
m_recordCount =
Call connect()
End Sub
private property Get GetConnectionString()
if InStr(LCase(Request
GetConnectionString = "Provider=microsoft
else
GetConnectionString = "Provider=microsoft
end if
end property
public property Let SetPageSize(num)
if Not isNumeric(num) then Exit property
num = CInt(num)
if num >
End property
public property Let AppendQueryString(paraName
m_QueryString = m_QueryString & "&" & paraName & "=" & Server
end property
public property Let SetPageIndex(num)
if Not isNumeric(num) then Exit property
num = CInt(num)
if num >
End property
public default function toString()
toString = strError
end function
private sub Connect()
Set m_oConn = Server
m_oConn
m_oConn
if err then
strError = err
Response
err
DeleteObject(m_oConn)
Response
end if
end sub
private sub Close(ByRef DBObject)
if
end sub
public function ExecuteScalar(strSql)
ExecuteScalar = m_oConn
end function
public sub Execute(ByVal strSql)
if (Not isObject(m_oConn)) then Exit Sub
m_oConn
end sub
private function OpenRS()
OpenRS = false
if ((Not isObject(m_oConn)) Or m_oConn
if (isObject(m_oRS)) then
if
else
Set m_oRS = Server
end if
OpenRS = true
end function
public function GetData(ByVal strSql)
if not OpenRS() then
GetData = null
exit function
end if
call m_oRS
if m_oRS
GetData = null
else
GetData = m_oRS
end if
m_oRS
end function
public function GetMultPageData(ByVal strSQL)
if Not OpenRS() then
GetMultPageData = null
exit function
end If
Call m_oRS
if m_oRS
GetMultPageData = null
else
m_oRS
m_recordCount = m_oRS
m_pageCount = m_oRS
if (m_pageIndex > m_pageCount) then m_pageIndex = m_pageCount
m_oRS
GetMultPageData = m_oRS
end if
Call m_oRS
end function
public function PageInfo(style)
Dim sHtml : set sHtml = new StringBuild
sHtml
call sHtml
Select Case style
Case
call sHtml
else
call sHtml
end if
if m_pageCount = m_pageIndex then
call sHtml
else
call sHtml
end if
Case
interval =
startPage = m_pageIndex
if startPage <
endPage = startPage +
if endPage > m_pageCount then endPage = m_pageCount
startPage = endPage
if startPage <
if
call sHtml
else
call sHtml
end if
for i = startPage to m_pageIndex
call sHtml
next
call sHtml
for i = m_pageIndex+
call sHtml
next
if m_pageCount = m_pageIndex then
sHtml
else
call sHtml
end if
end Select
call sHtml
PageInfo = sHtml
DeleteObject(sHtml)
end function
private Sub Class_Terminate()
Close(m_oRS)
Close(m_oConn)
DeleteObject(m_oRS)
DeleteObject(m_oConn)
End Sub
end Class
dim i
oDB
oDB
arrData = oDB
for i =
echo(arrData(
next
echo(oDB
DeleteObject(oDB)
From:http://tw.wingwit.com/Article/program/net/201311/14409.html