App_Code/BLL/SearchBooks.cs
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;
/// <summary>
///SearchBooks 的摘要说明
/// </summary>
public class SearchBooks
{
public SearchBooks()
{
//
//TODO: 在此处添加构造函数逻辑
//
}
public DataTable GetSearchBooks(string name, string categories,string minprice,string maxprice )
{
string strSql = string.Empty;
bool first = true;
if (string.IsNullOrEmpty(name) &&string.IsNullOrEmpty(categories)&&string.IsNullOrEmpty(minprice)&&string.IsNullOrEmpty(maxprice) )
{
strSql = "SELECT WenJu.Id, Categories.Name AS Expr1, WenJu.Name , WenJu.Price, WenJu.Coliknum, WenJu.Sale, WenJu.Introduction, WenJu.ISBN FROM Categories INNER JOIN WenJu ON Categories.Id = WenJu.CategoriesId ";
return DAL.DataAccess.ExecuteQuery(strSql, CommandType.Text);
}
else
{
strSql = "SELECT WenJu.Id, Categories.Name AS Expr1, WenJu.Name , WenJu.Price, WenJu.Coliknum, WenJu.Sale, WenJu.Introduction, WenJu.ISBN FROM Categories INNER JOIN WenJu ON Categories.Id = WenJu.CategoriesId where ";
}
List<SqlParameter> lists = new List<SqlParameter>();
if (!string.IsNullOrEmpty(name))
{
if (first)
{
strSql += " WenJu.Name like @Name ";
first = false;
}
else
strSql += " And WenJu.Name like @Name";
lists.Add(new SqlParameter("@Name", "%" + name + "%"));
}
if (!string.IsNullOrEmpty(categories))
{
if (first)
{
strSql += " Categories.Name like @Categories ";
first = false;
}
else
strSql += " And Categories.Name like @Categories";
lists.Add(new SqlParameter("@Categories", "%" + categories + "%"));
}
if (!string.IsNullOrEmpty(minprice))
后面还有 32 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。