using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data.SqlClient; using System.Configuration; using System.Data; public partial class Default2 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void btnlogin_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection("Data Source=...........;Initial Catalog=EmployeeDB;Integrated Security=True"); con.Open(); SqlCommand cmd = new SqlCommand("select * from information where Username=@Username and Password=@Password", con); cmd.Parameters.AddWithValue("@Username", TextBox1.Text); cmd.Parameters.AddWithValue("@Password", TextBox2.Text); SqlDataAdapter ad = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); ad.Fill(dt); if (dt.Rows.Count > 0) { Session["Username"] = TextBox1.Text; Response.Redirect("Default3.aspx"); } else { Label3.Visible = true; Label3.Text = "Invalid Username&Password....!!!"; } } protected void Button1_Click(object sender, EventArgs e) { Response.Redirect("Default5.aspx"); } }
causevalidation
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)