Since we want to judge the user level through integrals, a private function is defined here:
Private Function getlevel()
bpoint=killint(bpoint,0,0)
If bpoint<500 Then
blevel="Junior Member"
ElseIf bpoint>=500 And bpoint<=100 Then
blevel="Premium Member"
Else
blevel="Ultimate Member"
End If
Getlevel=blevel
End Function
If we want to get the information to be returned to the user, we must define a public public function to display the information:
Public Function showuser()
("<h5>The following information showing <font color=red>"&bname&"</font>:</h5>")
("<h5>Gender:<font color=red>"&bsex&"</font></h5>")
("<h5>Points:<font color=red>"&bpoint&"</font></h5>")
getlevel
("<h5>Level:<font color=red>"&blevel&"</font></h5>")
End Function
End class
When using this class, use it like this: (I wrote a form for processing here)
Set blueideauser=new blueidea
=Trim(request("id"))
=request("sex")
=request("point")
Do you want to see the effect? Let's take a look here: http:///net/aspclass/
Classes that control reading database information:
Reference source code
'Name: ado_5do8
'Function: read the various operations of the database
'Source-Gengyun Village http://-5do8
'Creation: 5do8
'Contact:5do8@
'Updated: November 13, 2005
'Authorization: Blue Ideal website has more than 3,000 points, all registered users in Gengyun Village
'Class interface: ado_5do8.ConnectString=Absolute path of the database
'ado_5do8.rs_top Number of calls, name of the table
Class ado_5do8
Private conn,sqlstr,rs,iid,itable,isession
'sqlstr: Database address, absolute path, private
'conn: Open the database connection, private
'------------------------------------------------------------------
rem Eliminate some unwanted numbers
Private Function litter_in(r1,r2)
If IsNumeric(r1) and IsNumeric(r2) Then
Dim dimrr
If r1>r2 Then
dimrr=r2
Else
dimrr=r1
End If
Else
dimrr=0
End if
litter_in=dimrr
End Function
'-----------------------------------------------------------------
Private Function killint(i,killstr,killsub)
If Not IsNumeric(i) Then
i=killstr
ElseIf i<=0 Then
i=killsub
End if
killint=Int(Left(i,5))
End Function
'-----------------------------------------------------------
private Sub startconn()
On Error Resume Next
Set conn=("")
strconn="Provider=.4.0;Data Source=" & (sqlstr)
strconn
If Err Then
Set Conn = Nothing
mess="Error occurred, the database cannot be connected"
(mess)
Else
mess="Conn connection to the database conn successfully...<br/>"
(mess)
End If
End Sub
'----------------------------------------------------------------
private Sub closeconn()
Set conn=Nothing
("<strong style='color:red'>Close the conn connection</strong>...<hr/>")
End sub
'-----------------------------------------------------------------
Private Sub closers()
Set rs=Nothing
("<strong style='color:#085420'>Close database RS</strong>......<br/>")
End Sub
'-----------------------------------------------------------------
Property Get havese
havese=isession
End Property
Property Let havese(yoursession)
isession=yoursession
If yoursession="" Then
isession="nodef"
End If
End Property
'-----------------------------------------------------------------
Public Function makesession(arraydata)
If IsArray(arraydata) then
makear=arraydata
Else
makear=Array(0,0,0,0)
End If
If isession="" Then
isession="nodef"
End if
session(isession)=makear
End Function
'-----------------------------------------------------------------
private Function getsession()
thisget=session(isession)
If Not IsArray(thisget) Then
thisget=Array(0,0,0,0)
End If
Getsession=thisget
End function
'-----------------------------------------------------------------
Property Get ConnectString
ConnectString = sqlstr
End Property
Property Let ConnectString(str)
sqlstr = str
End Property
'-----------------------------------------------------------------
Property Get getid
getid = iid
End Property
Property Let getid(id)
iid = id
End Property
'-----------------------------------------------------------------
Property Get gettable
gettable = itable
End Property
Property Let gettable(table)
itable = table
End Property
'-----------------------------------------------------------------
'------------------------------------------------------------------
public Function readarraysession(iStart,ipageno,irowid)
rowid=killint(irowid,0,0)
start=killint(istart,0,0)
pageno=killint(ipageno,5,5)
data=getsession
iRows = UBound(data, 2)
iCols = UBound(data, 1)
("<h5>Total number obtained:")
("<b> "&iRows+1&"</b>Message</h5><hr/><ul style='width:100%;'>")
If rowid = 0 then
If iRows > (ipageno + iStart) Then
iStop = ipageno + iStart - 1
Else
iStop = iRows
End If
For iRowLoop = Start to iStop
("<li style='padding:4px 0;'><a href=?k=read&row>"&data(1, iRowLoop) & " </a><span style='padding:4px 0 4px 10px;background-color:#ccc; '>Slower, click--><a href=?k=list&>Update</a></span></li>")
Next
"</ul><div style='top:20px;background-color:#ccc;color:#020;font-weight:bold;bordr-top:2px solid #008;padding:10px 0;color:#b00'>list(<a href=>Return to typical mode</a>):"
if Start > 0 then
"<A HREF=""?k=read&Start=" & iStart-ipageno &"&pageno=" & ipageno & """>Previous</A>"
end if
if iStop < iRows then
" <A HREF=""?k=read&Start=" & iStart+ipageno &"&pageno=" & ipageno & """>Next</A>"
end If
"</div>"
Else
rowid=litter_in(rowid-1,iRows)
("<div style='width:85%'><h4 style='text-align:center'><a href=?k=read&pageno="&pageno&"&start="&start&">Return to the list</a></h4></h2><hr/><h5>"&(data(1,rowid))&"</h5><p>"&(data(2,rowid))&"<h5>+-----"&(data(3,rowid))&")
("<div >")
End if
End Function
'-----------------------------------------------------------------
Public Function list_ids()
sql3="select * from "&itable&" where "
startconn()
Set rs=(sql3)
If And Then
data=Array(0,0,0,0)
Else
data=()
End If
closers
closeconn
(UBound(data)&":")
((data(2,0)))
End function
'-----------------------------------------------------------------
Public Function rs_top(num,table,whe)
startconn()
sql="select top "&num&" * from "&table&""
sql2="select count(*) as szd_count from "&table&" "" "&whe&""
Set rs=(sql2)
szd_count=rs("szd_count")
closers
Set rs = (sql)
dim data
If Then
data="no data"
Else
data=()
End if
closers
closeconn()
Call makesession (data)
End Function
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
End Class
When using:
Dim action
action=request("k")
If action="view" Then
Call viewnew
ElseIf action="list" Then
Call list()
ElseIf action="read" Then
Call read()
Else
Call ff()
End if
Sub ff()
%>
<form style="border-top:2px solid #008;border-bottom:2px solid #008;margin:auto;background-color:#eee;padding:20px 5px;color:#008;font-weight:bold;">
<label>Total number of displayed information:<input name="n" type="text" maxlength="4" size="10" />Number of each page:<input name="pagesize" type="text" maxlength="4" size="10" value="5"/><input name="arrsstart" type="hidden" value="0"></label>
<h5 style="border-top:1px solid #000;padding:5px 0"> Operation:<input name="k" type="submit" value="view" //</h5>
</form> <%End sub%>
<%Sub viewnew()
f_num=killint(request("n"),1,1)
pagesize=killint(request("pageno"),5,5)
arrstart=killint(request("start"),0,0)
rowid=killint(request("rowid"),0,0)
Set cs=new ado_5do8
="data/"
="shi"
cs.rs_top f_num,"site_szd",""
arrstart,pagesize,rowid
End sub
Sub list()
("<h5><a href=>Return to the default mode</a></h5>")
"The specific information is displayed below:<hr/>"
id=request("id")
id=killint(id,1,1)
Set listid=new ado_5do8
="data/"
=id
="site_szd"
listid.list_ids()
End Sub
Sub read()
"<div style='background-color:#ccc;padding:20px 0;color:080;font-weight:bold;border-bottom:2px solid #008'>The page analysis is completed. To update, please select <a href=>Back to typical mode</a> Parameters: Start, start element; pageno, number of pages per page</div>"
pagesize=killint(request("pageno"),5,5)
arrstart=killint(request("start"),0,0)
rowid=killint(request("rowid"),0,0)
Set cs=new ado_5do8
="shi"
arrstart,pagesize,rowid
End sub
Function killint(i,killstr,killsub)
If Not IsNumeric(i) Then
i=killstr
ElseIf i<=0 Then
i=killsub
End if
killint=Int(Left(i,5))
End Function
%>
Demo at: http:///net/aspclass
Private Function getlevel()
bpoint=killint(bpoint,0,0)
If bpoint<500 Then
blevel="Junior Member"
ElseIf bpoint>=500 And bpoint<=100 Then
blevel="Premium Member"
Else
blevel="Ultimate Member"
End If
Getlevel=blevel
End Function
If we want to get the information to be returned to the user, we must define a public public function to display the information:
Public Function showuser()
("<h5>The following information showing <font color=red>"&bname&"</font>:</h5>")
("<h5>Gender:<font color=red>"&bsex&"</font></h5>")
("<h5>Points:<font color=red>"&bpoint&"</font></h5>")
getlevel
("<h5>Level:<font color=red>"&blevel&"</font></h5>")
End Function
End class
When using this class, use it like this: (I wrote a form for processing here)
Set blueideauser=new blueidea
=Trim(request("id"))
=request("sex")
=request("point")
Do you want to see the effect? Let's take a look here: http:///net/aspclass/
Classes that control reading database information:
Reference source code
'Name: ado_5do8
'Function: read the various operations of the database
'Source-Gengyun Village http://-5do8
'Creation: 5do8
'Contact:5do8@
'Updated: November 13, 2005
'Authorization: Blue Ideal website has more than 3,000 points, all registered users in Gengyun Village
'Class interface: ado_5do8.ConnectString=Absolute path of the database
'ado_5do8.rs_top Number of calls, name of the table
Class ado_5do8
Private conn,sqlstr,rs,iid,itable,isession
'sqlstr: Database address, absolute path, private
'conn: Open the database connection, private
'------------------------------------------------------------------
rem Eliminate some unwanted numbers
Private Function litter_in(r1,r2)
If IsNumeric(r1) and IsNumeric(r2) Then
Dim dimrr
If r1>r2 Then
dimrr=r2
Else
dimrr=r1
End If
Else
dimrr=0
End if
litter_in=dimrr
End Function
'-----------------------------------------------------------------
Private Function killint(i,killstr,killsub)
If Not IsNumeric(i) Then
i=killstr
ElseIf i<=0 Then
i=killsub
End if
killint=Int(Left(i,5))
End Function
'-----------------------------------------------------------
private Sub startconn()
On Error Resume Next
Set conn=("")
strconn="Provider=.4.0;Data Source=" & (sqlstr)
strconn
If Err Then
Set Conn = Nothing
mess="Error occurred, the database cannot be connected"
(mess)
Else
mess="Conn connection to the database conn successfully...<br/>"
(mess)
End If
End Sub
'----------------------------------------------------------------
private Sub closeconn()
Set conn=Nothing
("<strong style='color:red'>Close the conn connection</strong>...<hr/>")
End sub
'-----------------------------------------------------------------
Private Sub closers()
Set rs=Nothing
("<strong style='color:#085420'>Close database RS</strong>......<br/>")
End Sub
'-----------------------------------------------------------------
Property Get havese
havese=isession
End Property
Property Let havese(yoursession)
isession=yoursession
If yoursession="" Then
isession="nodef"
End If
End Property
'-----------------------------------------------------------------
Public Function makesession(arraydata)
If IsArray(arraydata) then
makear=arraydata
Else
makear=Array(0,0,0,0)
End If
If isession="" Then
isession="nodef"
End if
session(isession)=makear
End Function
'-----------------------------------------------------------------
private Function getsession()
thisget=session(isession)
If Not IsArray(thisget) Then
thisget=Array(0,0,0,0)
End If
Getsession=thisget
End function
'-----------------------------------------------------------------
Property Get ConnectString
ConnectString = sqlstr
End Property
Property Let ConnectString(str)
sqlstr = str
End Property
'-----------------------------------------------------------------
Property Get getid
getid = iid
End Property
Property Let getid(id)
iid = id
End Property
'-----------------------------------------------------------------
Property Get gettable
gettable = itable
End Property
Property Let gettable(table)
itable = table
End Property
'-----------------------------------------------------------------
'------------------------------------------------------------------
public Function readarraysession(iStart,ipageno,irowid)
rowid=killint(irowid,0,0)
start=killint(istart,0,0)
pageno=killint(ipageno,5,5)
data=getsession
iRows = UBound(data, 2)
iCols = UBound(data, 1)
("<h5>Total number obtained:")
("<b> "&iRows+1&"</b>Message</h5><hr/><ul style='width:100%;'>")
If rowid = 0 then
If iRows > (ipageno + iStart) Then
iStop = ipageno + iStart - 1
Else
iStop = iRows
End If
For iRowLoop = Start to iStop
("<li style='padding:4px 0;'><a href=?k=read&row>"&data(1, iRowLoop) & " </a><span style='padding:4px 0 4px 10px;background-color:#ccc; '>Slower, click--><a href=?k=list&>Update</a></span></li>")
Next
"</ul><div style='top:20px;background-color:#ccc;color:#020;font-weight:bold;bordr-top:2px solid #008;padding:10px 0;color:#b00'>list(<a href=>Return to typical mode</a>):"
if Start > 0 then
"<A HREF=""?k=read&Start=" & iStart-ipageno &"&pageno=" & ipageno & """>Previous</A>"
end if
if iStop < iRows then
" <A HREF=""?k=read&Start=" & iStart+ipageno &"&pageno=" & ipageno & """>Next</A>"
end If
"</div>"
Else
rowid=litter_in(rowid-1,iRows)
("<div style='width:85%'><h4 style='text-align:center'><a href=?k=read&pageno="&pageno&"&start="&start&">Return to the list</a></h4></h2><hr/><h5>"&(data(1,rowid))&"</h5><p>"&(data(2,rowid))&"<h5>+-----"&(data(3,rowid))&")
("<div >")
End if
End Function
'-----------------------------------------------------------------
Public Function list_ids()
sql3="select * from "&itable&" where "
startconn()
Set rs=(sql3)
If And Then
data=Array(0,0,0,0)
Else
data=()
End If
closers
closeconn
(UBound(data)&":")
((data(2,0)))
End function
'-----------------------------------------------------------------
Public Function rs_top(num,table,whe)
startconn()
sql="select top "&num&" * from "&table&""
sql2="select count(*) as szd_count from "&table&" "" "&whe&""
Set rs=(sql2)
szd_count=rs("szd_count")
closers
Set rs = (sql)
dim data
If Then
data="no data"
Else
data=()
End if
closers
closeconn()
Call makesession (data)
End Function
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
End Class
When using:
Dim action
action=request("k")
If action="view" Then
Call viewnew
ElseIf action="list" Then
Call list()
ElseIf action="read" Then
Call read()
Else
Call ff()
End if
Sub ff()
%>
<form style="border-top:2px solid #008;border-bottom:2px solid #008;margin:auto;background-color:#eee;padding:20px 5px;color:#008;font-weight:bold;">
<label>Total number of displayed information:<input name="n" type="text" maxlength="4" size="10" />Number of each page:<input name="pagesize" type="text" maxlength="4" size="10" value="5"/><input name="arrsstart" type="hidden" value="0"></label>
<h5 style="border-top:1px solid #000;padding:5px 0"> Operation:<input name="k" type="submit" value="view" //</h5>
</form> <%End sub%>
<%Sub viewnew()
f_num=killint(request("n"),1,1)
pagesize=killint(request("pageno"),5,5)
arrstart=killint(request("start"),0,0)
rowid=killint(request("rowid"),0,0)
Set cs=new ado_5do8
="data/"
="shi"
cs.rs_top f_num,"site_szd",""
arrstart,pagesize,rowid
End sub
Sub list()
("<h5><a href=>Return to the default mode</a></h5>")
"The specific information is displayed below:<hr/>"
id=request("id")
id=killint(id,1,1)
Set listid=new ado_5do8
="data/"
=id
="site_szd"
listid.list_ids()
End Sub
Sub read()
"<div style='background-color:#ccc;padding:20px 0;color:080;font-weight:bold;border-bottom:2px solid #008'>The page analysis is completed. To update, please select <a href=>Back to typical mode</a> Parameters: Start, start element; pageno, number of pages per page</div>"
pagesize=killint(request("pageno"),5,5)
arrstart=killint(request("start"),0,0)
rowid=killint(request("rowid"),0,0)
Set cs=new ado_5do8
="shi"
arrstart,pagesize,rowid
End sub
Function killint(i,killstr,killsub)
If Not IsNumeric(i) Then
i=killstr
ElseIf i<=0 Then
i=killsub
End if
killint=Int(Left(i,5))
End Function
%>
Demo at: http:///net/aspclass