实体获取单条记录包括简单的获取单条记录和自定义获取单条记录。
GetContents
获取单条信息——简单示例
示例
LotteryModel lottery = new LotteryModel() { Lot_id = 11151 }.Get();
LotteryModel lottery = new LotteryModel() { Lot_title = "140823-78期" }.Get();
LotteryModel lottery = new LotteryModel() { Lot_title = "140823-78期" }.Get();
获取单条信息——自定义获取
示例
LotteryModel lottery = new LotteryModel();
lottery.Sql = new Sql()
{
Type = DataObject.Enum.SqlType.Custom,
ComType= System.Data.CommandType.Text,
CmdText = "select top 1 * from lottery where lot_title='测试8'"
};
lottery = lottery.Get();
lottery.Sql = new Sql()
{
Type = DataObject.Enum.SqlType.Custom,
ComType= System.Data.CommandType.Text,
CmdText = "select top 1 * from lottery where lot_title='测试8'"
};
lottery = lottery.Get();