public IList<users> Select(string where)
{
return this.Select(where, false, false);
}
/// <summary>
/// 得到数据表users满足查询条件的记录
/// </summary>
/// <param name="where">查询条件</param>
/// <param name="bParentTable">是/否设置与父表对象关联</param>
/// <param name="bChildrenTable">是/否设置与子表对象关联</param>
/// <returns>结果集</returns>
public IList<users> Select(string where, bool bParentTable, bool bChildrenTable)
{
IList<users> list = new List<users>();
SqlParameter[] param ={
new SqlParameter("@where",SqlDbType.VarChar,8000)
};
param[0].Value = where;
string sqlCommand = "usersSelectByParams";
using (SqlDataReader dr = SqlHelper.ExecuteReader(Conn.SqlConn,CommandType.StoredProcedure, sqlCommand, param))
{
while (dr.Read())
{
list.Add(this.Select(dr));
}
}
foreach (users obj in list)
{
this.Select(obj, bParentTable, bChildrenTable);
}
return list;
}
list.Add(this.Select(dr)); this指什么意思 类名public partial class userDAL :IusersDAL 中的
userDAL ?
protected void Page_Load(object sender, EventArgs e)
{
string loginuser=this.Request["u"];
string password=this.Request["p"];
String where = "u_username='{0}' and u_password='{1}'";
where = string.Format(where,loginuser,password);
IList<users> userslist=usersBLL.Select(where,true,false);
if (userslist.Count != 0)
{
users uu = userslist[0];
Session.Add("loginuser", uu);
this.Response.Write(string.Format(GetRedirect.REDIRECT, "index.htm"));
}
看好这个where昂,它在存储过程中怎么没用啊 你看存储过程这个
ALTER PROCEDURE [dbo].[usersSelectByParams]
@where varchar(8000) = ' 1=1 '
AS
SET NOCOUNT ON
declare @filter varchar(8000)
set @filter = '
SELECT
[u_id],
[u_username],
[u_password],
[u_dept_id],
[u_em_id],
[u_state],
[u_logintime],
[u_logindegree],
[u_pwdbind],
[u_g_id],
[u_landip]
FROM [dbo].[users]
where '
exec (@filter + @where + ' ORDER BY [u_id] DESC')
RETURN @@Error
我怎么发现就没用到 where中 uwsername和userupwd 这是个登陆 解释下 怎么回事 ??谢了