sql - “Operation must use an updateable query” error in MS Access
问题描述
This question has been asked many times, my case seems to be the simplest, still I did not find the answer to my question...
The environment is Windows, Access 2013. Table tbl_rap is linked, resides on MS SQL Server 2007
Table tbl_rap is constructed as follows:
id - int (Identity)
field_1 nchar(10)
field_2 nchar(1)
The following code works
sql_cmd = "INSERT INTO tbl_rap (field_1,field_2) VALUES ('010308HB3','R')"
DoCmd.RunSQL sql_cmd
But this code
sql_cmd = "UPDATE tbl_rap SET field_2 = 'X' WHERE field_1 = '010308HB3'"
DoCmd.RunSQL sql_cmd
fails with run-time error 3037 "Operation must use an updateable query"
Any help would be appreciated.
解决方案
当您使用 nchar(10) 时,您必须传递一个 10 个字符的字符串,例如:
sql_cmd = "UPDATE tbl_rap SET field_2 = 'X' WHERE field_1 = '010308HB3 '"
推荐阅读
- docker - Confluent Kafka代理容器内的jmx导出器
- python - 按其他条件过滤数据框时包含 if 语句
- java - 使用 userDetail 使用 Spring Boot Withot 进行 JWT 身份验证
- swift - 在 SwiftUI 中将 URL 和文本共享到 Facebook 或 Twitter?
- vba - 如何将 Word(有方程式)转换为 PowerPoint?
- reactjs - 不从道具初始化状态
- apache-spark - 在pyspark中将列转换为日期格式(DDMMMyyyy)。我将整个列(日期)设为空
- postgresql - 使用 Solr 父子关系进行搜索的查询
- javascript - 如何让我的 JavaScript 游戏每隔几秒停止一次冻结?
- sql - 过程和隐式游标编译错误