<% Option Explicit %>
<%
Dim TestFlag,DataBaseType,TempConnStr
Dim DBC,TestConn
TestFlag = Request("TestFlag")
DataBaseType = Request("DataBaseType")
if TestFlag = "1" then
	if DataBaseType = "1" then
		Dim SqlServer,SqlDataBase,SqlUser,SqlPassWord
		SqlServer = Request("SqlServer")
		SqlDataBase = Request("SqlDataBase")
		SqlUser = Request("SqlUser")
		SqlPassWord = Request("SqlPassWord")
		TempConnStr = "Provider=SQLOLEDB.1;Persist Security Info=False;Server=" & SqlServer & ";User ID=" & SqlUser & ";Password=" & SqlPassWord & ";Database=" & SqlDataBase & ";"
		On Error Resume Next
		Set TestConn = Server.CreateObject("ADODB.Connection") 
		TestConn.Open TempConnStr 
		if Err.Number <> 0 then
			Response.Write("<script>alert('数据库连接错误');</script>")  
		else
			Response.Write("<script>alert('数据库连接正确');</script>")  
		end if
		Set TestConn = Nothing
	elseif DataBaseType = "2" then
		Dim AccessServer,AccessDB,AccessUser,AccessPassWord
		AccessServer = Request("AccessServer")
		AccessDB = Request("AccessDB")
		AccessUser = Request("AccessUser")
		AccessPassWord = Request("AccessPassWord")
		On Error Resume Next
		if AccessDB = "1" then
			TempConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & AccessServer & ";Jet OLEDB:Database Password=" & AccessPassWord & ";Persist Security Info=False"
		else
			TempConnStr = "DBQ=" + server.mappath(AccessServer) + ";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
		end if
		Set TestConn = Server.CreateObject("ADODB.Connection") 
		TestConn.Open TempConnStr
		if Err.Number <> 0 then
			Response.Write("<script>alert('数据库连接错误');</script>")  
		else
			Response.Write("<script>alert('数据库连接正确');</script>")  
		end if
		Set TestConn = Nothing
	else
%>
	<script language="JavaScript">
	alert('参数传递错误');
	</script>
<%
	end if
end if
%>
<script language="JavaScript">
parent.SetBtnStatus(false);
</script>