最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
缓存类及打开数据库连接函数
时间:2022-07-02 23:49:43 编辑:袖梨 来源:一聚教程网
懒人的作品,我连长一点点的代码,都写成函数了。。。
用起来,可以偷懒,哈哈。。。
<%'@ LANGUAGE = VBScript CodePage = 936
Dim jz
Set jz=New jz_clsmain
jz.Cache_count=0
jz.web_name="华人中小企业资源网"
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(Replace(Server.MapPath("/"),"/",""),":",""),"","")
CacheName=request.servervariables("url")
CacheName=left(CacheName,instrRev(CacheName,"/"))&"jz"
Cache_count=1000
web_name="匠族"
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&"
")
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<定义选择的DB(str0),并定义conn(str0)及rs(str0)>;str1=true,false<是否创建数据库连接>;str2=true,false<是否创建rs对象>;
Public Function c_r_s(str0,str1,str2)
On Error Resume Next
if str1 then
Set Conn(str0) = Server.CreateObject("ADODB.Connection")
用起来,可以偷懒,哈哈。。。
<%'@ LANGUAGE = VBScript CodePage = 936
Dim jz
Set jz=New jz_clsmain
jz.Cache_count=0
jz.web_name="华人中小企业资源网"
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(Replace(Server.MapPath("/"),"/",""),":",""),"","")
CacheName=request.servervariables("url")
CacheName=left(CacheName,instrRev(CacheName,"/"))&"jz"
Cache_count=1000
web_name="匠族"
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&"
")
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<定义选择的DB(str0),并定义conn(str0)及rs(str0)>;str1=true,false<是否创建数据库连接>;str2=true,false<是否创建rs对象>;
Public Function c_r_s(str0,str1,str2)
On Error Resume Next
if str1 then
Set Conn(str0) = Server.CreateObject("ADODB.Connection")
相关文章
- 无期迷途哈梅尔依偎涟漪怎么样 11-25
- 剑与远征折翼苍空攻略 11-25
- 光遇11.25每日任务怎么做 光遇11月25日每日任务做法攻略 11-25
- 光遇11.25季节蜡烛在哪里 光遇11月25日季节蜡烛位置攻略 11-25
- 崩坏星穹铁道2.7前瞻有什么活动 崩铁2.7版本前瞻新增内容介绍 11-25
- “十月朝,糍粑碌碌烧”是说哪个习俗 蚂蚁庄园11月22日答案最新 11-25