软件开发学习笔记

我还要学很多东西chanllenge everyThing

分层架构的模糊查询问题笨方法

 private const string SQL_SELECT_ALLLIST = "SELECT * FROM Counseling where uid=@UID";
 private const string PARM_UID = "@UID";
  public DataTable Search(Model.Counseling CSL)
        {
            SqlParameter[] SearchParms = new SqlParameter[1];
            SearchParms[0] = new SqlParameter(PARM_SEARCH, SqlDbType.VarChar,10);
            SearchParms[0].Value = CSL.search;
            if (CSL.searchKind == "CAuthor")
            {
                SQL_SELECT_SEARCH = SQL_SELECT_SEARCH + " AND Counseling.CAuthor like '%'+@SEARCH+'%'";
            }
            if (CSL.searchKind == "CContent")
            {
                SQL_SELECT_SEARCH = SQL_SELECT_SEARCH + " AND Counseling.CContent LIKE '%'+@SEARCH+'%'";
            }
            using (DataSet ds = SqlHelper.ExecuteDataset(SqlHelper.CONN_STRINGCSL, CommandType.Text, SQL_SELECT_SEARCH, SearchParms))
            {
                return ds.Tables[0];
            }
        }

 

阅读更多
上一篇 PagedDataSource实现分页datalist,gridview。。。
下一篇动态网页初学者用ASP.NET制作备忘录实例
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭