0
{
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();
}
保護無效的button1_Click(對象發件人,EventArgs的){ 錯誤而做頁面登錄爲ASP.NET應用程序和SQL服務器
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 { }
}
,這是我的類代碼它給我這個錯誤 錯誤1無法隱式轉換類型「無效」到「對象」
錯誤2未重載方法「EmpLoginbyId」需要1個參數