当前位置:网站首页>C# EF mysql更新datetime字段报错Modifying a column with the ‘Identity‘ pattern is not supported
C# EF mysql更新datetime字段报错Modifying a column with the ‘Identity‘ pattern is not supported
2022-04-23 06:09:00 【qq_15197419】
报错:

原因分析:
错误提示的意思是:我的lastAskTime字段是自增的,所以我不能修改他的值,但是datetime类型也不能设置自增啊? 尝试数据库直接用sql更新,没问题,那基本锁定是EF的问题了,但是能力有限,并没有找出什么原因。解决方案:
最后发现,把lastAskTime字段的默认值“CURRENT_TIMESTAMP”去掉或改为一个固定值(重新生成项目中的数据库实例)就不再报错了。

搞不明白,这个默认值应该只是新建行时起效果,EF为啥在更新时要把它判断为是个自增字段?
版权声明
本文为[qq_15197419]所创,转载请带上原文链接,感谢
https://blog.csdn.net/qq_15197419/article/details/122975597
边栏推荐
猜你喜欢

webView因证书问题显示一片空白

iTOP4412 HDMI显示(4.4.4_r1)

Cause: dx.jar is missing

Google AdMob advertising learning

this. getOptions is not a function

Personal blog website construction

oracle表的约束详解

JVM basics you should know

取消远程依赖,用本地依赖
![[recommendation for new books in 2021] professional azure SQL managed database administration](/img/f1/b38cce1dc328a5b534011169909127.png)
[recommendation for new books in 2021] professional azure SQL managed database administration
随机推荐
[多屏互动] 实现双多屏异显二:startActivity方式
iTOP4412 FramebufferNativeWindow(4.0.3_r1)
oracle视图相关
【2021年新书推荐】Red Hat Certified Engineer (RHCE) Study Guide
iTOP4412 HDMI显示(4.4.4_r1)
Explore how @ modelandview can forward data and pages through the source code
【2021年新书推荐】Practical Node-RED Programming
[2021 book recommendation] artistic intelligence for IOT Cookbook
中国各省会城市经纬度位置
oracle用delete删除数据所需时间测试
AVD Pixel_2_API_24 is already running.If that is not the case, delete the files at C:\Users\admi
Google AdMob advertising learning
记录webView显示空白的又一坑
Project, how to package
实习做了啥
测试oracle库700万数据量普通方式创建索引所需时间
JNI中使用open打开文件是返回-1问题
oracle创建表空间和修改用户默认表空间
Android面试计网面经大全【持续更新中。。。】
组件化学习(1)思想及实现方式