Caching classes and opening database connection functions
Source: Internet
Author: User
Lazy Man's work, my company commander a little bit of code, have written functions ...
Use up, can be lazy, haha ...
<% ' @ LANGUAGE = VBScript CodePage = 936
Dim JZ
Set jz=new Jz_clsmain
Jz. Cache_count=0
Jz.web_name= "Chinese SME Resource Network"
Class Jz_clsmain
Public rs,conn,sql,db
Public Web_name,t,t_s,t_h,cache
Public i_0,i_1
Public Reloadtime,cachename,localcachename,cache_data,cache_count
Private Sub Class_Initialize ()
ReDim db (4), Conn (4), RS (4), SQL (4)
ReDim T (20,4), t_s (20,3)
Reloadtime=14400*60
' Cachenamecachename=replace (replace (Server.MapPath ("/"), "/", ""), ":", ""), "", "" "
Cachename=request.servervariables ("url")
Cachename=left (Cachename,instrrev (CacheName, "/")) & "JZ"
cache_count=1000
Web_name= "The Carpenter clan"
End Sub
Private Sub Class_Terminate ()
I_1=lbound (DB)
For I_0=0 to I_1
On Error Resume Next
' Response.Write (i_0& "<br/><br/>")
If IsObject (RS (i_0)) then RS (i_0). Close:set rs (i_0) =nothing
If IsObject (Conn (i_0)) Then Conn (I_0). Close:set Conn (i_0) = Nothing
Next
End Sub
Public Function tree_00 (STR_0)
Dim i,jz_temp (1)
For I=0 to Str_0
Jz_temp (0) =jz_temp (0) &jz_temp (1)
Jz_temp (1) = ".. /"
Next
Tree_00=jz_temp (0)
End Function
Public Function conn_00 (str_0,str_1)
Str_1=tree_00 (str_1)
DB (Str_0) = "Provider = Microsoft.jet.oledb.4.0;data Source =" & Server.MapPath (str_1& "Data/data_" &str_0 & ". mdb")
' Response.Write (db (STR_0))
End Function
' str0=0-4< defines the selected db (STR0) and defines Conn (STR0) and RS (STR0) >;str1=true,false< whether to create a database connection >;str2=true,false< Whether to create RS objects >;
Public Function c_r_s (STR0,STR1,STR2)
On Error Resume Next
If Str1 Then
Set Conn (STR0) = Server.CreateObject ("ADODB. Connection ")
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