29 07 2019

LIKE '%@Title%' 会解析成'%'@Title'%' 这里用拼接也是不行的'%'+@Title+'%' 只能用MySQL函数方法拼接

1
2
3
4
5
6
7
8
9
10
11
12
13
14
public dynamic GetListByFilter(ArticleModel filter, PageInfo pageInfo)
        {
            string _where = " where 1=1";
            if (!string.IsNullOrEmpty(filter.Title))
            {
                //LIKE '%@Title%' 会解析成'%'@Title'%' 这里用拼接也是不行的'%'+@Title+'%' 只能用MySQL函数方法拼接
                _where += " and Title LIKE CONCAT('%',@Title,'%')";
            }
            if (filter.Status != null)
            {
                _where += " and Status=@Status";
            }
            return GetListByFilter(filter, pageInfo, _where);
        }
延伸阅读
  1. Net Core 新手入门推荐项目_ZingBlog: Net 6.0 全新开源的博客系统
  2. 系统封装工具及教程基于WIN10封装公司专属系统封装系统详细步骤