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

 

posted @ 2021-06-17 16:22  ꧁执笔小白꧂  阅读(206)  评论(0编辑  收藏  举报