TiDB使用BulkUpdateAsync报错 返回

SqlSugar 沟通中
2 71

image.png

报错写法:await repositoryComparisonLog.Context.Fastest<ComparisonLogOperationalSupport>().BulkUpdateAsync([.. comparisonLogList], ["Id"], ["YcScore", "HkScore", "GlScore", "IsExclude", "IsShow"]);

报错信息:You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 1 column 50 near "SELECT `PersonnelInfoId`,`ObjectLibraryInfoId`,`AffirmType`,`IsExclude`,`IsShow`,`YcScore`,`HkScore`,`GlScore`,`Id`,`CTime`,`UTime` FROM `comparisonlog`  WHERE ( 1 = 2 )  ) "

image.png

临时替代方案:await repositoryComparisonLog.AsUpdateable(comparisonLogList.ToArray()).WhereColumns(s => s.Id).UpdateColumns(s => new { s.YcScore, s.HkScore, s.GlScore, s.IsExclude, s.IsShow }).ExecuteCommandAsync();


comparisonLogList内是有值的,从错误信息来看,where生成的好像不对,这样写查不到任何数据的,然后就是where后边有两个括号WHERE ( 1 = 2 )  ) 

使用的SqlSugar是5.1.4.185,TiDB是社区版8.5.5目前社区最新版


热忱回答2

  • 正常不会出现 WHERE ( 1 = 2 )  

    需要提供实体。

    0 回复
  • 这个问题,我记得我已经删除了的,因为我试了一下更新到最新版的SqlSugarCore5.1.4.211问题已被解决

    0 回复