mysql 之C#使用insert批量插入时日期字段为null,插入报错解决方案

string nextRepairDate = "''";
if (eqInfo?.NextRepairDate != null)
{
nextRepairDate = $"'{eqInfo?.NextRepairDate}'";
}
insert into table(NextRepairDate) values(IF({nextRepairDate}= '',null,{nextRepairDate})) 

 

posted @ 2020-04-17 13:37  吴政恒  阅读(1006)  评论(0编辑  收藏  举报