using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
// Response.Write("<script>alert('dd');</script>");
}
protected void ok_click(object sender, EventArgs e)
{
// Response.Write("<script>alert('dd');</script>");
if (user(this.name1.Text) != 0)
{
Response.Write("<script>alert('succeed!');</script>");
}
}
protected int user(string tmpuser)
{
string SelectCmd = "SELECT COUNT(*) FROM LoginPwd WHERE Name ='" + tmpuser + "'";
string strCon = "Data Source=localhost;Integrated Security=SSPI;Initial Catalog=LoginPassword";
SqlConnection SqlCon = new SqlConnection(strCon);
SqlCon.Open();
SqlCommand SqlCmd = new SqlCommand(SelectCmd,SqlCon);
int count;
count = Convert.ToInt32(SqlCmd.ExecuteScalar());
return count;
}
}