MyBookShopDAL/CategoryService.cs
(完整代码) 1KBusing System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MyBookShop.Model;
using System.Data.SqlClient;
namespace MyBookShop.DAL
{
public class CategoryService
{
/// <summary>
/// 获得分类信息
/// </summary>
/// <param name="cateId">分类ID</param>
/// <returns>分类</returns>
public Categories GetCate(int cateId)
{
Categories cate = null;
string sqlStr = "select * from Categories where Id = " + cateId;
SqlDataReader reader = DBHelper.ExecuteGetReader(System.Data.CommandType.Text, sqlStr, null);
if (reader.Read())
{
cate = new Categories();
cate.Id = reader.GetInt32(0);
cate.Name = reader.GetString(1);
cate.PId = reader.GetInt32(2);
if (!reader.IsDBNull(3))
{
cate.SortNum = reader.GetInt32(3);
}
}
reader.Dispose();
return cate;
}
}
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。