Dapper查询是否存在数据

开始用的

int count = conn.Query<int>(sqlStr, param).FirstOrDefault();  // return count > 0 ? true : false;

 报错,所以我用的是

using System.Linq;
using Dapper;

int
count = connection.Query(sqlStr.ToString(), new { Phone = phone }).Count(); // 引用Linq
365个夜晚,我希望做到两天更一篇博客。加油,小白!
原文地址:https://www.cnblogs.com/qq2806933146xiaobai/p/14894022.html