Home Database Mysql Tutorial c#操作access,update语句不执行的解决办法

c#操作access,update语句不执行的解决办法

Jun 07, 2016 pm 03:50 PM
access update manage operate solve statement

1首先试试下面的方法: 参数位置必须和赋顺序相同才行 ,否则更新时就会出现数据无法更新但是也不报错的怪现象。 例如:update tablename set [a]=@a1,[b]=@a2 where [id]=@a3 那么你在加参数时,也必须先加@a,再加@b,最后加@id.也就是说必须要 cmd.Paramete

1首先试试下面的方法:

参数位置必须和赋值顺序相同才行,否则更新时就会出现数据无法更新但是也不报错的怪现象。
       例如:update tablename set [a]=@a1,[b]=@a2 where [id]=@a3
       那么你在加参数时,也必须先加@a,再加@b,最后加@id.也就是说必须要 
cmd.Parameters.AddWithValue(“@a1”,a);

cmd.Parameters.AddWithValue(“@a2”,b);

cmd.Parameters.AddWithValue(“@a3”,id);

2 上面不行的话再试试下面的方法

今天打开一个Access库,要修改其中的有些数据,就新建了一个更新查询,保存后双击执行,没有反应。仔细检查了一下,查询代码应该没问题,再执行,还是没反应。因本人装的是Office2007,用得还不熟练,一下子还真没了办法。在反复执行当中,发现状态栏有提示:“操作或事件已被禁用模式阻止”,看来与安全设置有关,在网上一搜,终于找到解决方法:

       仅当数据库未驻留在受信任位置或者未签名时,才执行下列步骤。每次打开不受信任或未签名的数据库时,Access 都会显示文档操作栏。

在“消息栏”上,单击“选项”。
在“Microsoft Office 安全选项”对话框中,单击“启用此内容”,然后单击“确定”。
如果没有看到消息栏
在“数据库工具”选项卡上的“显示/隐藏”组中,单击“消息栏”。

 

在 Access 2007 中执行更新查询时,出现“操作或事件已被禁用模式阻止”。

c#操作access,update语句不执行的解决办法
选中“数据库工具”中的“消息栏”,然后单击“选项”。

c#操作access,update语句不执行的解决办法
选中“启用此内容”,确定。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to disable background applications in Windows 11_Windows 11 tutorial to disable background applications How to disable background applications in Windows 11_Windows 11 tutorial to disable background applications May 07, 2024 pm 04:20 PM

How to disable background applications in Windows 11_Windows 11 tutorial to disable background applications

How to convert deepseek pdf How to convert deepseek pdf Feb 19, 2025 pm 05:24 PM

How to convert deepseek pdf

Can't allow access to camera and microphone in iPhone Can't allow access to camera and microphone in iPhone Apr 23, 2024 am 11:13 AM

Can't allow access to camera and microphone in iPhone

What does dao mean in java What does dao mean in java Apr 21, 2024 am 02:08 AM

What does dao mean in java

What does field mean in java What does field mean in java Apr 25, 2024 pm 10:18 PM

What does field mean in java

How does the Java reflection mechanism modify the behavior of a class? How does the Java reflection mechanism modify the behavior of a class? May 03, 2024 pm 06:15 PM

How does the Java reflection mechanism modify the behavior of a class?

How to cross-domain iframe in vue How to cross-domain iframe in vue May 02, 2024 pm 10:48 PM

How to cross-domain iframe in vue

KDE Plasma 6.1 brings many enhancements to the popular Linux desktop KDE Plasma 6.1 brings many enhancements to the popular Linux desktop Jun 23, 2024 am 07:54 AM

KDE Plasma 6.1 brings many enhancements to the popular Linux desktop

See all articles