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

📄 conn1.asp

📁 千年免费电影系统 V3.0版 在程序上借鉴了很多优秀电影系统的功能
💻 ASP
字号:
<!--#include file="ads.ini" -->

<%
	'如果使用国外主页空间,请使用下面语句:'
	'rem codepage="936"	'
	
	
	dim conn
	dim connstr
	dim db
	'更改数据库名字'
	db="../333/data/movie.mdb"
	on error resume next
	Set conn = Server.CreateObject("ADODB.Connection")

	if err then 
		err.clear
		errormsg="<BR><li>操作失败,无法创建数据库对象!"
		call disperrs(errormsg)
		response.end
	end if

	connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(""&db&"")
	conn.Open connstr

	if err then 
		err.clear
		errormsg="<BR><li>操作失败,无法创建数据库连接!"
		call disperrs(errormsg)
		response.end
	end if


  	sub endConnection()
      		conn.close
      		set conn=nothing
  	end sub



	sub disperrs(errormsg)'出错提示'
	%>
	出错
	<%
	end sub

	Function SafeRequest(ParaName,ParaType) 
		'--- 传入参数 ---防止SQL注入 '
		'ParaName:参数名称-字符型' 
		'ParaType:参数类型-数字型(1表示以上参数是数字,0表示以上参数为字符)' 
		
		Dim ParaValue 
		ParaValue = Request(ParaName) 
		If ParaType = 1 then 
			If not isNumeric(ParaValue) then 
				Response.write "参数" & ParaName & "必须为数字型!" 
				Response.end 
			End if 
		Else 
			ParaValue=replace(ParaValue,"","") 
		End if 
		SafeRequest=ParaValue 
	End function 

	function connClose'关闭数据库
		Conn.close
		Set conn = Nothing
	End Function

%>

⌨️ 快捷键说明

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