conn.asp

来自「一个互联网络公司网站源码」· ASP 代码 · 共 53 行

ASP
53
字号
<%connbl=0
vdir=""
	if instr(request.ServerVariables("URL"),"login.asp")<1 then
		if instr(request.ServerVariables("URL"),"/admin/")>0 then
			if session("LoginID")="" then
	%>
	<script>
	parent.location.href="/admin/login.asp";
	</script>
	<%
			response.End()
			end if
		end if
	
	end if

	set conn=server.CreateObject("adodb.connection")
	if connbl=1 then
	ConnStr="server=.;driver={sql server};database=TTNet;uid=sa;pwd="
	else
	connstr="DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("ttdb/ttwl.asp") 
	'connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data; Source="& Server.MapPath("../ttdb/ttwl.asp")
	end if
	conn.open connstr
	if err.number>0 then
	response.Write("数据库错误,请联系管理员")
	response.End()
	end if
	
		Function InterceptString(txt,length)
		txt=trim(txt)
		x = len(txt)
		y = 0
		if x >= 1 then
		for ii = 1 to x
		if asc(mid(txt,ii,1)) < 0 or asc(mid(txt,ii,1)) >255 then
		   y = y + 2
		else
		   y = y + 1
		end if
		  if y >= length-2 then
			 txt = left(trim(txt),ii)&"…" '"字符串限长
		  exit for
		end if
		next
		   InterceptString = txt
		else
		   InterceptString = ""
		end if
		End Function

%>

⌨️ 快捷键说明

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