私は乗客とドライバーという2種類のユーザーがいます。同じログインページで2種類のユーザーのログイン
protected void Button1_Click(object sender, EventArgs {
SqlConnection con = new SqlConnection(conString);
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "SP_SELECT_Login1";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Connection = con;
cmd.Parameters.AddWithValue("@Email", txtEmail.Text);
cmd.Parameters.AddWithValue("@Password", txtPassword.Text);
SqlDataAdapter ad = new SqlDataAdapter();
DataSet ds = new DataSet();
ad.SelectCommand = cmd;
ad.Fill(ds);
if (ds.Tables[0].Rows.Count > 0)
{
Session["UserId"] = ds.Tables[0].Rows[0]["Reg_id"].ToString();
Session["Username"] = ds.Tables[0].Rows[0]["Fname"].ToString();
Response.Redirect("Profile.aspx");
}
else
{
lblMsg.Text = "Incorrect User and Password or Unverify user";
}
}