⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 conn.asp

📁 xml缓存类试用版用于ASP
💻 ASP
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%

Option Explicit
session.CodePage="936"
Server.ScriptTimeOut=900    '脚本超时时间(单位:秒)
Session.Timeout=20         'Session过期时间(单位:分钟)
Response.Expires=-1
Response.Buffer=true
response.charset="gb2312"



dim conn
dim startime
startime = Timer()  '数据库执行开始时间

Function openConn()'打开数据库连接
	dim connstr   
	If not isobject(conn) Then
		'On Error Resume Next
		connstr = "Provider=Microsoft.Jet.Oledb.4.0;Data Source=" & Server.Mappath("Data/theme.mdb")
		set conn=server.createobject("ADODB.CONNECTION")
		conn.open connstr
		
		If Err Then
			Err.Clear
			Set Conn = Nothing
			Response.Write "数据库连接出错,请打开conn.asp文件检查连接字串。"
			Response.End
		End If
	End If
End Function

'关闭主数据库,并释放公用类对象
Function closeConn()
	If  isobject(conn) Then
		conn.close
		set conn = Nothing
	End If
End Function




'**************************************************
'函数名:gotTopic
'作  用:截字符串,汉字一个算两个字符,英文算一个字符
'参  数:str   ----原字符串
'       strlen ----截取长度
'返回值:截取后的字符串
'***************************************************
function walkgotTopic(str,strlen)
	if str="" then
		walkgotTopic=""
		exit function
	end if
	dim l,t,c, i
	str=replace(replace(replace(replace(str,"&nbsp;"," "),"&quot;",chr(34)),"&gt;",">"),"&lt;","<")
	l=len(str)
	t=0
	for i=1 to l
		c=Abs(Asc(Mid(str,i,1)))
		if c>255 then
			t=t+2
		else
			t=t+1
		end if
		if t>=strlen then
			walkgotTopic=left(str,i) & ""
			exit for
		else
			walkgotTopic=str
		end if
	next
	walkgotTopic=replace(replace(replace(replace(walkgotTopic," ","&nbsp;"),chr(34),"&quot;"),">","&gt;"),"<","&lt;")
end function

%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -