using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
public partial class signin : System.Web.UI.Page
{
SqlConnection mycon = new SqlConnection("server=.;database=ccsit;uid=sa;pwd=sa");
SqlCommand cmd = new SqlCommand();
protected void Page_Load(object sender, EventArgs e)
{
mycon.Open();
cmd.Connection = mycon;
}
protected void Button1_Click(object sender, EventArgs e)
{
cmd.CommandText = "select count (*) from login where uname ='" + TextBox1.Text + "' and pwd='" + TextBox2.Text + "'";
int i =(int)cmd.ExecuteScalar();
if (i == 1)
{
Session["uname"] = TextBox1.Text;
Response.Redirect("home.aspx");
}
else
Response.Write("");
TextBox1.Text = "";
}
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
{
}
}
No comments:
Post a Comment