当前位置:网站首页>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
边栏推荐
- SQL中 with函数的详解与用法
- 【2021年新书推荐】Artificial Intelligence for IoT Cookbook
- BottomSheetDialogFragment + ViewPager+Fragment+RecyclerView 滑动问题
- iTOP4412 HDMI显示(4.0.3_r1)
- MySQL notes 1_ database
- Component learning
- Bottomsheetdialogfragment conflicts with listview recyclerview Scrollview sliding
- Itop4412 cannot display boot animation (4.0.3_r1)
- [2021 book recommendation] effortless app development with Oracle visual builder
- 第三篇:docker安装mysql容器(自定义端口)
猜你喜欢

Cancel remote dependency and use local dependency

谷歌AdMob广告学习

双指针仪表盘读数(一)

从0开始封装一套项目的网络请求框架
![[2021 book recommendation] artistic intelligence for IOT Cookbook](/img/8a/3ff45a911becb895e6dd9e061ac252.png)
[2021 book recommendation] artistic intelligence for IOT Cookbook

Cause: dx.jar is missing

组件化学习(2)Arouter原理学习

C#新大陆物联网云平台的连接(简易理解版)

Component learning (2) arouter principle learning

AVD Pixel_2_API_24 is already running.If that is not the case, delete the files at C:\Users\admi
随机推荐
Markdown basic grammar notes
MySQL笔记4_主键自增长(auto_increment)
oracle表空间表分区详解及oracle表分区查询使用方法
MySQL5. 7 insert Chinese data and report an error: ` incorrect string value: '\ xb8 \ XDF \ AE \ xf9 \ X80 at row 1`
oracle中生成32位uuid
oracle生成毫秒级时间戳
Record WebView shows another empty pit
【2021年新书推荐】Practical IoT Hacking
ThreadLocal,看我就够了!
Itop4412 surfaceflinger (4.4.4_r1)
Abnormal record-11
What did you do during the internship
組件化學習
Android清除应用缓存
[recommendation for new books in 2021] professional azure SQL managed database administration
oracle视图相关
第三篇:docker安装mysql容器(自定义端口)
【2021年新书推荐】Kubernetes in Production Best Practices
JS 比较2个数组中不同的元素
adb shell top 命令详解