<%
Set conn = Server.CreateObject("ADODB.Connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("/Database/sq_xikeedu.mdb")
If Err Then 
err.Clear 
Set Conn = Nothing 
Response.Write "数据库连接出错，请检查连接字串。" 
Response.End 
End If
'====弹出窗口过程 ====
sub mb(text,go,url)
    response.Write("<script language='javascript'>")
	response.Write("alert('"&text&"');")
	if go<>1 then
		response.Write("history.go(-1);")
    else
		response.write ("document.location.href='"&url&"';")
    end if
	response.Write("</script>")
	response.End()
end sub
'====关闭连接 释放资源的过程 ==== 
sub CloseConn() 
Conn.close 
set Conn=nothing 
end sub
'-----------------
Function Confirm(strAlert,url1,url2)
	Response.Write("<Script Language='Javascript'>")
	Response.Write("if(confirm('"& strAlert &"'))")
	Response.Write("{")
	Response.Write("location.href='" & url1 & "';")
	Response.Write("}")
	Response.Write("else")
	Response.Write("{")
	Response.Write("location.href='" & url2 & "';")
	Response.Write("}")
	Response.Write("</Script>")
End Function
Function GetSafeStr(str)
	GetSafeStr = Replace(Replace(Replace(Trim(str), "'", ""), Chr(34), ""), ";", "")
End Function

Function GetSafeInt(iCheck,iDefault) 
	If Trim(iCheck)="" Then
		GetSafeInt = iDefault
		Exit Function
	End If

	If IsNumeric(iCheck)=false Then
		GetSafeInt = iDefault
		Exit Function
	End If
	GetSafeInt = iCheck
End Function
	' ===============================================
' 初始化下拉框
'	s_FieldName	: 返回的下拉框名	
'	a_Name		: 定值名数组
'	a_Value		: 定值值数组
'	v_InitValue	: 初始值
'	s_Sql		: 从数据库中取值时,select name,value from table
'	s_AllName	: 空值的名称,如:"全部","所有","默认"
' ===============================================
Function InitSelect(s_FieldName, a_Name, a_Value, v_InitValue, s_Sql, s_AllName)
	Dim i
	InitSelect = "<select name='" & s_FieldName & "' size=1>"
	If s_AllName <> "" Then
		InitSelect = InitSelect & "<option value=''>" & s_AllName & "</option>"
	End If
	If s_Sql <> "" Then
		rs.Open s_Sql, oConn, 0, 1
		Do While Not rs.Eof
			InitSelect = InitSelect & "<option value=""" & inHTML(rs(1)) & """"
			If rs(1) = v_InitValue Then
				InitSelect = InitSelect & " selected"
			End If
			InitSelect = InitSelect & ">" & outHTML(rs(0)) & "</option>"
			rs.MoveNext
		Loop
		rs.Close
	Else
		For i = 0 To UBound(a_Name)
			InitSelect = InitSelect & "<option value=""" & inHTML(a_Value(i)) & """"
			If a_Value(i) = v_InitValue Then
				InitSelect = InitSelect & " selected"
			End If
			InitSelect = InitSelect & ">" & outHTML(a_Name(i)) & "</option>"
		Next
	End If
	InitSelect = InitSelect & "</select>"
End Function
Function inHTML(str)
	Dim sTemp
	sTemp = str
	inHTML = ""
	If IsNull(sTemp) = True Then
		Exit Function
	End If
	sTemp = Replace(sTemp, "&", "&amp;")
	sTemp = Replace(sTemp, "<", "&lt;")
	sTemp = Replace(sTemp, ">", "&gt;")
	sTemp = Replace(sTemp, Chr(34), "&quot;")
	inHTML = sTemp
End Function
Function outHTML(str)
	Dim sTemp
	sTemp = str
	outHTML = ""
	If IsNull(sTemp) = True Then
		Exit Function
	End If
	sTemp = Replace(sTemp, "&", "&amp;")
	sTemp = Replace(sTemp, "<", "&lt;")
	sTemp = Replace(sTemp, ">", "&gt;")
	sTemp = Replace(sTemp, Chr(34), "&quot;")
	sTemp = Replace(sTemp, Chr(10), "<br>")
	outHTML = sTemp
End Function

Function RemoveHTML( strText ) 
Dim RegEx 
Set RegEx = New RegExp 
RegEx.Pattern = "<[^>]*>" 
RegEx.Global = True 
RemoveHTML = RegEx.Replace(strText, "") 
End Function 
%>  