{
public DataTable EmpLoginbyId()
{
SqlConnection con = new SqlConnection("server=(local);database=schoolsystem;integrated security=true");
SqlCommand cmd = new SqlCommand();
DataTable dt = new DataTable();
SqlDataAdapter adp = new SqlDataAdapter("EmpLoginbyId", con);
cmd.CommandType = CommandType.StoredProcedure;
adp.Fill(dt);
return dt;
}
public void EmpLogin(string Email, String Password)
{
SqlConnection con = new SqlConnection("server=(local);database=schoolsystem;integrated security=true");
SqlCommand cmd = new SqlCommand("EmpLogin", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@Email", Email);
cmd.Parameters.AddWithValue("@passward", Password);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
}
protected void Button1_Click(object sender, EventArgs e) {
try
{
Session["UID"] = Lgn.EmpLogin(TxtUN.Text, TxtPW.Text);
int? UID = Convert.ToInt32(Session["UID"].ToString());
DataTable dt = new DataTable();
dt = Lgn.EmpLoginbyId(Convert.ToInt32(UID));
string Username = dt.Rows[0]["UserName"].ToString();
//string Username = dt.Rows[0]["UserName"].ToString();
Session["ETID"] = Convert.ToInt32(dt.Rows[0]["UserTypeID"].ToString());
if (Username == null)
{
Session["UserName"] = Username.ToString();
}
if (UID.HasValue)
{
Response.Redirect("Admin.aspx");
}
}
catch { }
}
and this is my class code it gives me this error
Error 1 Cannot implicitly convert type 'void' to 'object'
Error 2 No overload for method 'EmpLoginbyId' takes 1 arguments