using System; using System.Collections.Generic; using System.Configuration; using System.Data.SqlClient; using System.Data; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace BCD.admin { public partial class Default : System.Web.UI.Page { SqlConnection connect = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString); SqlDataAdapter adp; SqlCommand cmd; //Class1 obj = new Class1(); protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { txtUsername.Focus(); } } protected void btnLogin_Click(object sender, EventArgs e) { string sel = "select * from adminlogin where userid='" + txtUsername.Text + "' and pswd='" + txtPassword.Text + "'"; SqlDataAdapter da = new SqlDataAdapter(sel, connect); DataTable dt = new DataTable(); da.Fill(dt); if (dt.Rows.Count > 0) { Session["UserName"] = txtUsername.Text; Response.Redirect("HomePage.aspx"); } else { RegisterStartupScript("12", ""); } } } }