当前位置:网站首页>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
边栏推荐
- 三种实现ImageView以自身中心为原点旋转的方法
- adb shell 常用命令
- Itop4412 LCD backlight drive (PWM)
- iTOP4412 FramebufferNativeWindow(4.0.3_r1)
- oracle给对象重命名
- What did you do during the internship
- BottomSheetDialogFragment + ViewPager+Fragment+RecyclerView 滑动问题
- ./gradlew: Permission denied
- Kotlin征途之data class [数据类]
- 第三篇:docker安装mysql容器(自定义端口)
猜你喜欢
./gradlew: Permission denied
[2021 book recommendation] red hat rhcsa 8 cert Guide: ex200
组件化学习(3)ARouter中的Path和Group注解
组件化学习(2)Arouter原理学习
BottomSheetDialogFragment 与 ListView RecyclerView ScrollView 滑动冲突问题
AVD Pixel_2_API_24 is already running.If that is not the case, delete the files at C:\Users\admi
ThreadLocal,看我就够了!
组件化学习(1)思想及实现方式
【2021年新书推荐】Practical IoT Hacking
双指针仪表盘读数(一)
随机推荐
Google AdMob advertising learning
ARGB透明度换算
iTOP4412 LCD背光驱动(PWM)
个人博客网站搭建
adb shell 常用命令
js时间获取本周一、周日,判断时间是今天,今天前、后
npm ERR code 500解决
BottomSheetDialogFragment + ViewPager+Fragment+RecyclerView 滑动问题
组件化学习
Itop4412 kernel restarts repeatedly
oracle表空间表分区详解及oracle表分区查询使用方法
【2021年新书推荐】Effortless App Development with Oracle Visual Builder
【2021年新书推荐】Artificial Intelligence for IoT Cookbook
Personal blog website construction
C connection of new world Internet of things cloud platform (simple understanding version)
launcher隐藏不需要显示的app icon
【2021年新书推荐】Red Hat Certified Engineer (RHCE) Study Guide
统一任务分发调度执行框架
[2021 book recommendation] artistic intelligence for IOT Cookbook
记录webView显示空白的又一坑