达尔代码
public DataSet selectlogin(string u_name, string u_password, string u_email, string action)
{
SqlConnection con = new SqlConnection(h);
SqlCommand cmd = new SqlCommand("", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "sp_login";
cmd.Parameters.AddWithValue("@name", u_name);
cmd.Parameters.AddWithValue("@email", u_email);
cmd.Parameters.AddWithValue("@password", u_password);
cmd.Parameters.AddWithValue("@action", action);
con.Open();
cmd.ExecuteNonQuery();
DataSet ds = new DataSet();
SqlDataAdapter ad = new SqlDataAdapter(cmd);
ad.Fill(ds);
return ds;
con.Close();
}
巴尔代码
public DataSet selectlogin(string u_name, string u_password, string u_email, string action)
{
DataSet ds = new DataSet();
ds = obj.selectlogin(u_name, u_password, u_email, action);
return ds;
}
客户服务代码
protected void Btn_log(object sender, EventArgs e)
{
DataSet ds = new DataSet();
ds = obj.selectlogin("", TextBox1.Text, TextBox2.Text,"login");
if (ds.Tables[0].Rows.Count > 0)
{
Response.Redirect("dashboard.aspx");
}
}
存储过程
if(@action='login')
select * from login where u_email=@email and u_pass=@password