protected void Page_Load(object sender, EventArgs e) { try { String qry; if (!IsPostBack) { if (Session["uid"].ToString() == "") { Response.Redirect("Index.aspx"); } else { qry = "select * from UserDB where User_Id='" + Session["uid"].ToString() + "'"; SqlDataReader dr = ProjectClass.getRecords(qry); if (dr.Read()) { string s = dr.GetValue(2).ToString() + " " + dr.GetValue(3).ToString(); lblName.Text = "Hello"; string a = dr.GetValue(5).ToString(); lblEmail.Text = dr.GetValue(5).ToString(); lblAddress.Text = dr.GetValue(7).ToString(); lblResidentalArea.Text = dr.GetValue(8).ToString(); lblContact.Text = dr.GetValue(10).ToString(); } dr.Close(); } } } catch { } finally { } }
protected void Page_Load(object sender, EventArgs e) { string s = "select * from User_Business"; using (SqlDataReader dr = ProjectClass.getRecords(s)) { Repeater1.DataSource = dr; Repeater1.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { String qry = "SELECT * FROM User_Business WHERE BId=" + Session["Bid"].ToString(); try { SqlDataReader dr = ProjectClass.getRecords(qry); if (dr.Read()) { txtName.Text = dr.GetValue(2).ToString(); txtAdress.Text = dr.GetValue(3).ToString(); ddlCategory.SelectedItem.Equals(dr.GetValue(4).ToString()); txtContact.Text = dr.GetValue(5).ToString(); ddlArea.SelectedItem.Equals(dr.GetValue(6).ToString()); txtEmail.Text = dr.GetValue(7).ToString(); txtDescription.Text = dr.GetValue(8).ToString(); } dr.Close(); } catch { } }
protected void btnLogin_Click(object sender, EventArgs e) { string qry = "Select * from UserDB where Email='" + txtEmail.Text + "' and Password='******'"; SqlDataReader s = ProjectClass.getRecords(qry); if (s.Read()) { Session["uid"] = s.GetValue(0).ToString(); if (s.GetValue(8).ToString() == "Admin") { Response.Redirect("AdminDashBoard.aspx"); } else { Response.Redirect("CustomerDashBoard.aspx"); } } else { Label1.Text = "Enter Proper Data"; } }