本文整理汇总了C#中CategoryInfo.LoadFromDataRow方法的典型用法代码示例。如果您正苦于以下问题:C# CategoryInfo.LoadFromDataRow方法的具体用法?C# CategoryInfo.LoadFromDataRow怎么用?C# CategoryInfo.LoadFromDataRow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CategoryInfo
的用法示例。
在下文中一共展示了CategoryInfo.LoadFromDataRow方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Find
/// <summary>
/// 根据分页获得数据列表
/// </summary>
/// <param name="TbFields">返回字段</param>
/// <param name="strWhere">查询条件</param>
/// <param name="OrderField">排序字段</param>
/// <param name="PageIndex">页码</param>
/// <param name="PageSize">页尺寸</param>
/// <param name="TotalCount">返回总记录数</param>
/// <returns>IList<CategoryInfo></returns>
public IList<CategoryInfo> Find(string tbFields, string strWhere, string orderField, int pageIndex, int pageSize, out int totalCount)
{
IList<CategoryInfo> list = new List<CategoryInfo>();
using (DbCommand cmd = db.GetStoredProcCommand("SP_SqlPagenation"))
{
db.AddInParameter(cmd, "@TbName", DbType.String, "Category");
db.AddInParameter(cmd, "@TbFields", DbType.String, tbFields);
db.AddInParameter(cmd, "@StrWhere", DbType.String, strWhere);
db.AddInParameter(cmd, "@OrderField", DbType.String, orderField);
db.AddInParameter(cmd, "@PageIndex", DbType.Int32, pageIndex);
db.AddInParameter(cmd, "@PageSize", DbType.Int32, pageSize);
db.AddOutParameter(cmd, "@Total", DbType.Int32, int.MaxValue);
using (DataTable dt = db.ExecuteDataSet(cmd).Tables[0])
{
if (dt.Rows.Count > 0)
{
foreach (DataRow dr in dt.Rows)
{
CategoryInfo model = new CategoryInfo();
model.LoadFromDataRow(dr);
list.Add(model);
}
}
}
totalCount = (int)db.GetParameterValue(cmd, "@Total");
return list;
}
}
示例2: Get
/// <summary>
/// 获得实体
/// </summary>
/// <param name="keyValue">编号</param>
/// <returns>CategoryInfo</returns>
public CategoryInfo Get(int keyValue)
{
CategoryInfo model = null;
using (DbCommand cmd = db.GetStoredProcCommand("SP_GetRecord"))
{
db.AddInParameter(cmd, "@TableName", DbType.String, "Category");
db.AddInParameter(cmd, "@KeyName", DbType.String, "CategoryID");
db.AddInParameter(cmd, "@KeyValue", DbType.Int32, keyValue);
using (DataTable dt = db.ExecuteDataSet(cmd).Tables[0])
{
if (dt.Rows.Count > 0)
{
model = new CategoryInfo();
model.LoadFromDataRow(dt.Rows[0]);
}
}
return model;
}
}