11.23 我的工作成绩
#region[筛选过后的信息]
public DataSet SelectLeaderMailbox(Model.WeTogether.LeaderMailboxModel model)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("select a.*,b.name from FM_LeaderMailbox a,dbo.FM_department b where a.departid=b.id");
if (model.departid != 0 )
{
strSql.Append(" and a.departid=@departid");
}
if(model.words !="")
{
strSql.Append(" and a.words like '%'+@words+'%'");
}
if(model.replay == "1")
{
strSql.Append(" and a.replay not like ''");
}
else if (model.replay == "0")
{
strSql.Append(" and a.replay like ''");
}
SqlParameter[] cmdParms ={
SqlHelper.CreateDbParameter("@departid",DbType.Int32,model.departid),
SqlHelper.CreateDbParameter("@words",DbType.String,model.words)
};
return SqlHelper.ExecuteDataSet(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, strSql.ToString(), cmdParms);
}
#endregion
使用并不是存储过程 因为存储过程过于稳定 参数的数目是明确的
我们直接用sql :带参数的sql查询 可以更为灵活使用了
一般应用于用于筛选表中的数据信息
------------------------------------------------------
在编写代码的过程中 遇到一些问题:
例如说,“能比较或排序 text、ntext 和 image 数据类型,除非使用 IS NULL 或 LIKE 运算符”
我不是要比较 我只是想知道 某个字段是否为空,但是这个字段是特殊的类型 (text、ntext 和 image 数据类型)
不能直接用= 、<>,也不可以用 is null 或是 is not null 毕竟我里面是空的字符串 而不是NULL
遇到这样的问题 我们要想到使用模糊查询 like
当 like '' ,则查找空的字段的那条数据,
当 not like '',则查找的是不是空字段的那条数据。
-------------------------------------------
还有关于权限问题,我知道这方面尤其重要及其强大 但是我知之甚少,
那些功能细微到每个页面 乃至每个页面的按钮之中。。
我觉得 我要对此熟练地掌握 需要时间 也需要我不懈的努力,加油咯!!