看起来在达珀有一个ExecuteScalar ..。
http://code.google.com/p/dapper-dot-net/issues/attachmentText?id=22&aid=220000000&name=ExecuteScalar.cs&token=9e2fd8899022f507b140ffb883c60e34
ExecuteScalar是否已重命名或删除?
现在可以使用.Query或.Query实现这一点吗
发布于 2014-08-13 05:21:00
1.28中刚刚添加了ExecuteScalar:https://www.nuget.org/packages/Dapper
发布于 2016-05-06 02:18:31
我可以在1.42.0版本中调用ExecuteScalar< T>
public Boolean BeforeToday(DateTime dateInQuestion)
{
try
{
using (var conn = new SqlConnection(ConnectionString))
{
String sql = @"SELECT CONVERT(bit, CASE WHEN getdate() > @dateParameter THEN 1 ELSE 0 END) AS BeforeToday";
var result = conn.ExecuteScalar<Boolean>(sql, new { dateParameter = dateInQuestion });
return result;
}
}
catch (Exception)
{
return dateInQuestion < DateTime.Now;
}
}发布于 2017-11-28 15:30:10
在1.50.4版本中,我能够调用connection.QuerySingle<int>(query,params)
https://stackoverflow.com/questions/8050636
复制相似问题