简单记一下,一会出去有点事情~
我们一般写sql都是==》update NoteInfo set NDataStatus=@NDataStatus where NId in (@NIds)
Dapper生成的sql是:
也就自然出错了:
简单修改一下:
int i = await NoteInfoBLL.ExecuteAsync("update NoteInfo set NDataStatus=@NDataStatus where NId in @NIds", new
{
NDataStatus = status,
NIds = ids.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries)
});Dapper生成sql:(类型再转换一下就ok了,这边只是说下方法,先闪了)
exec sp_executesql N'update NoteInfo set NDataStatus=@NDataStatus where NId in (@NIds1,@NIds2,@NIds3)',N'@NDataStatus int,@NIds1 nvarchar(4000),@NIds2 nvarchar(4000),@NIds3 nvarchar(4000)',@NDataStatus=99,@NIds1=N'1',@NIds2=N'2',@NIds3=N'3'
作者:
毒逆天
打赏:
18i4JpL6g54yAPAefdtgqwRrZ43YJwAV5z
本文版权归作者和博客园共有。欢迎转载,但必须保留此段声明,且在文章页面明显位置给出原文连接!