ASP object: Database result set Operation class

Source: Internet
Author: User
Tags count database join join
Objects | collection | data | database <%

’*************************************************************
' Please keep this declaration information when forwarding, this statement does not affect your speed!
’*************************************************************


’*************************************************************
' @author: Noodles
' @realname: Xu Renru
' @email: xurenlu@sohu.com
' @QQ: 55547082
' @Homepage: http://www.ksdn.net
' @ Copyright statement:
' Non-Profit groups or individuals are free to use.
’*************************************************************


’*************************************************************
’*************************************************************
’*************************************************************
Class Rsclass
Private IRs
Private isql
Private iconn
Private Closeconn
Private Openconn

’*************************************************************
' Initialize to create iconn and IRS objects.
’*************************************************************
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 "Data join is wrong."
End Sub

Public Property Let Conn (connection)
Set Iconn=connection ' incoming a database join via the outside world.
End Property



Private Sub Class_Terminate ()
On Error Resume Next
Irs.close
Iconn.close
Set iconn=nothing
Set irs=nothing
End Sub

’*************************************************************
' Content: Implements statistical functionality, typically using the select COUNT (*) from table where id>54 similar SQL statements.
’*************************************************************
Public function getcountbysql (SQL)
On Error Resume Next
Dim count
Count=iconn.execute (SQL) (0)
Getcountbysql=count
Iconn.close
End Function




’*************************************************************



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.