<%@ Page Language="C#" AutoEventWireup="true" CodeFile="LoginValidate.aspx.cs" Inherits="LoginValidate" %>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>验证用户名是否存在</title>
<script type="text/javascript">
var xmlHttp;
function createXMLHttpRequest()
{
if(window.ActiveXObject)
{
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else if(window.XMLHttpRequest)
{
xmlHttp = new XMLHttpRequest();
}
}
//处理方法
function CheckUserName()
{
createXMLHttpRequest();
var url= "LoginValidate.ashx?username="+document.getElementById("username").value;
xmlHttp.open("GET",url,true);
xmlHttp.onreadystatechange=ShowResult;
xmlHttp.send(null);
//document.getElementById("Msg").innerHTML='';
}
//回调方法
function ShowResult()
{
if(xmlHttp.readyState==4)
{
if(xmlHttp.status==200)
{
document.getElementById("Msg").innerHTML=xmlHttp.responseText;
}
}
}
</script>
</head>
<body>
<form ></param>
/// <returns></returns>
public DataSet ReDataSet(string strSQL)
{
SqlConnection con = new SqlConnection(strCon);
try
{
con.Open();
SqlDataAdapter da = new SqlDataAdapter(strSQL, con);
DataSet ds = new DataSet();
da.Fill(ds);
return ds;
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
finally
{
con.Close();
}
}
/// <summary>
/// 不重复调用
/// </summary>
public bool IsReusable
{
get
{
return false;
}
}
}