DBAccess部分 public static bool ExecuteQuery(string sql)
{
SqlCommand cmd = new SqlCommand(sql, conn);
try
{
ConnOpen();
int i = cmd.ExecuteNonQuery();
return i > 0 ? true : false;
}
catch
{
return false;
}
finally
{
ConnClose();
}
}
DAL部分namespace DAL
{
public class DLogin
{
public static bool Login_Info(Model.login m)
{
string sql = string.Format("select * from login where username='" + m.UserName + "'and password='" + m.PassWord + "'");
return DBAccess.ExecuteQuery(sql);
}
}
}BLL部分namespace BLL
{
public class LoginBLL
{
public bool Login_info(Model.login l)
{
return DAL.DLogin.Login_Info(l);
}
}
}
我在UI层引用BLL层中的Login_info时,如果不加static的话[public bool Login_info(Model.login l)],在UI中有智能提示出来,如果加上static的话,UI中没有智能提示了,请问是怎么回事?
{
SqlCommand cmd = new SqlCommand(sql, conn);
try
{
ConnOpen();
int i = cmd.ExecuteNonQuery();
return i > 0 ? true : false;
}
catch
{
return false;
}
finally
{
ConnClose();
}
}
DAL部分namespace DAL
{
public class DLogin
{
public static bool Login_Info(Model.login m)
{
string sql = string.Format("select * from login where username='" + m.UserName + "'and password='" + m.PassWord + "'");
return DBAccess.ExecuteQuery(sql);
}
}
}BLL部分namespace BLL
{
public class LoginBLL
{
public bool Login_info(Model.login l)
{
return DAL.DLogin.Login_Info(l);
}
}
}
我在UI层引用BLL层中的Login_info时,如果不加static的话[public bool Login_info(Model.login l)],在UI中有智能提示出来,如果加上static的话,UI中没有智能提示了,请问是怎么回事?
这问题....不是static的方法 需要实例化后才能调用。
点击搜索
LoginBLL.Login_info