2023年6月21日发(作者:)
通过带参数的Sql语句来实现模糊查询(多条件查询) #region 通过带参数的Sql语句来实现模糊查询(多条件查询) StringBuilder sb = new StringBuilder("select * from books"); List listWheres = new List(); List listParams = new List(); if (().Length > 0) { (" bookName like @bkName "); (new SqlParameter("@bkName", "%" + () + "%")); } if (().Length > 0) { (" PublishName like @pubName "); (new SqlParameter("@pubName", "%" + () + "%")); } if (().Length > 0) { (" Price = @price"); (new SqlParameter("@price", (()))); } if ( > 0) { (" where "); string wheres = (" and ", y()); (wheres); } (ng()); SqlParameter[] pms = y(); #endregion
2023年6月21日发(作者:)
通过带参数的Sql语句来实现模糊查询(多条件查询) #region 通过带参数的Sql语句来实现模糊查询(多条件查询) StringBuilder sb = new StringBuilder("select * from books"); List listWheres = new List(); List listParams = new List(); if (().Length > 0) { (" bookName like @bkName "); (new SqlParameter("@bkName", "%" + () + "%")); } if (().Length > 0) { (" PublishName like @pubName "); (new SqlParameter("@pubName", "%" + () + "%")); } if (().Length > 0) { (" Price = @price"); (new SqlParameter("@price", (()))); } if ( > 0) { (" where "); string wheres = (" and ", y()); (wheres); } (ng()); SqlParameter[] pms = y(); #endregion
发布评论