’*************************************************************
’ 停止初始化,创立iconn和irs对象.
’*************************************************************
Private Sub Class_initialize()
set iconn=server.createobject("adodb.connection")
set irs=server.createobject("adodb.recordset")
End Sub
public sub connect(connstr)
err.clear
on error resume next
iconn.open connstr
if err.number<>0 then response.write "数据联接失足了."
end sub
public property let conn(connection)
set iconn=connection ’经由过程外界传入一个数据库联接.
end property
Private Sub Class_Terminate()
on error resume next
irs.close
iconn.close
set iconn=nothing
set irs=nothing
End Sub
’*************************************************************
’ 内容:完成统计功效,普通用select count(*) from table where id>54相似的sql语句.
’*************************************************************
public function getCountBysql(sql)
on error resume next
dim count
count=iconn.execute(sql)(0)
getCountBysql=count
iconn.close
end function