|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
缺乏可以共同遵循的行业标准,ASP还处在发展初期,大家对它的理解不同,如产品和服务标准,收费标准等,不利于行业的健康发展。函数|缓存|数据|数据库|数据库毗连懒人的作品,我连长一点点的代码,都写成函数了。。。
用起来,能够偷懒,哈哈。。。
<%@LANGUAGE=VBScriptCodePage=936
Dimjz
Setjz=Newjz_clsmain
jz.Cache_count=0
jz.web_name="华人中小企业资本网"
Classjz_clsmain
Publicrs,conn,sql,db
Publicweb_name,t,t_s,t_h,cache
publici_0,i_1
publicReloadtime,CacheName,LocalCacheName,Cache_Data,Cache_count
PrivateSubClass_Initialize()
ReDimdb(4),conn(4),rs(4),sql(4)
ReDimt(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="匠族"
endsub
PrivateSubclass_terminate()
i_1=LBound(db)
fori_0=0toi_1
OnErrorResumeNext
Response.Write(i_0&"<br/><br/>")
ifisobject(rs(i_0))thenrs(i_0).close:setrs(i_0)=nothing
IfIsObject(Conn(i_0))ThenConn(i_0).Close:SetConn(i_0)=Nothing
next
EndSub
PublicFunctiontree_00(str_0)
dimi,Jz_temp(1)
fori=0tostr_0
Jz_temp(0)=Jz_temp(0)&Jz_temp(1)
Jz_temp(1)="../"
next
tree_00=Jz_temp(0)
endFunction
publicfunctionconn_00(str_0,str_1)
str_1=tree_00(str_1)
db(str_0)="Provider=Microsoft.Jet.OLEDB.4.0;DataSource="&Server.MapPath(str_1&"data/data_"&str_0&".mdb")
Response.Write(db(str_0))
endfunction
str0=0-4<界说选择的DB(str0),并界说conn(str0)及rs(str0)>;str1=true,false<是不是创立数据库毗连>;str2=true,false<是不是创立rs工具>;
PublicFunctionc_r_s(str0,str1,str2)
OnErrorResumeNext
ifstr1then
SetConn(str0)=Server.CreateObject("ADODB.Connection")
conn(str0).opendb(str0)
endif
ifstr2then
setRs(str0)=Server.CreateObject("ADODB.Recordset")
endif
EndFunction
PublicFunctionc_r_o(str0,str1,str2)
Rs(str0).Opensql(str0),Conn(str0),str1,str2
IfErrThen
err.Clear
Setconn(str0)=Nothing
Response.Write"数据库毗连堕落,请反省毗连字串。"正文,必要把这几个字翻译成英文。
Response.End
EndIf
EndFunction
PublicFunctionc_r_e(str0,str1,str2)
OnErrorResumeNext
ifstr2then
rs(str0).close
setrs(str0)=nothing
endif
ifstr1then
conn(str0).close
setconn(str0)=nothing
endif
EndFunction
PublicPropertyLetName(ByValvNewValue)
LocalCacheName=LCase(vNewValue)
EndProperty
PublicPropertyLetValue(ByValvNewValue)
IfLocalCacheName""Then
ReDimCache_Data(2)
Cache_Data(0)=vNewValue
Cache_Data(1)=Now()
Cache_Data(2)=Reloadtime
Application.Lock
Application(CacheName&"_"&LocalCacheName)=Cache_Data
Application.unLock
Else
Err.RaisevbObjectError+1,"jzCacheServer","pleasechangetheCacheName."
EndIf
EndProperty
PublicPropertyGetValue()
IfLocalCacheName""Then
Cache_Data=Application(CacheName&"_"&LocalCacheName)
IfIsArray(Cache_Data)Then
Value=Cache_Data(0)
Else
Err.RaisevbObjectError+1,"jzCacheServer","TheCache_Data("&LocalCacheName&")IsEmpty."
EndIf
Else
Err.RaisevbObjectError+1,"jzCacheServer","pleasechangetheCacheName."
EndIf
EndProperty
PublicFunctionObjIsEmpty()
app_count()
ObjIsEmpty=True
Cache_Data=Application(CacheName&"_"&LocalCacheName)
IfNotIsArray(Cache_Data)ThenExitFunction
IfNotIsDate(Cache_Data(1))ThenExitFunction
IfIsEmpty(Cache_Data(2))ThenExitFunction
IfDateDiff("s",CDate(Cache_Data(1)),Now())<(Cache_Data(2))ThenObjIsEmpty=False
EndFunction
PublicSubDelCahe(MyCaheName)
Application.Lock
Application.Contents.Remove(CacheName&"_"&MyCaheName)
Application.unLock
EndSub
publicsubapp_count()
ifApplication.Contents.Count>Cache_countthen
Application.Lock
Appli</p>ASP脚本是采用明文(plaintext)方式来编写的。 |
|