OpenFileDialog + OleDbConnection = AccessViolationException [英] OpenFileDialog + OleDbConnection = AccessViolationException
问题描述
我正在开发一个Windows WPF应用程序。
事情是我有一个 AccessViolationException
当使用 OpenFileDialog
和 OleDbConnection
对象。
场景:运行应用程序后,我单击一个显示 OpenFileDialog
表单的按钮,以便浏览文件。之后我使用 OleDbConnection
来引用MS Access .accdb文件。
问题:第一次运行此场景,一切正常,但是第二次尝试浏览文件或任何其他文件时发生异常;在打开表单并选择文件后发生。
调试代码后,我发现在尝试打开<$ c $的连接时c> OleDbConnection object [ex: dbConnecntion.Open()
]发生异常但如果省略它就会消失,即使我正在关闭连接处理资源。
异常: AccessViolationException
>>尝试读取或写入受保护的内存。这通常表明其他内存已损坏。
我过去一周试图摆脱同样的问题。终于找到这篇文章,表明它是Microsoft Access数据库引擎2010驱动程序中的错误。如果您使用 2007驱动程序,问题消失。
看看:
https://connect.microsoft.com/VisualStudio /feedback/details/624503/oledb-operations-cause-accessviolationexception-during-savefiledialog?wa=wsignin1.0
请投票支持修复 - 使用我可以重现这个bug和绿色勾选按钮
这个问题的关键是Provider = Microsoft.ACE.OLEDB.12.0; Data Source = C:\DbTest \Test.accdb ; OLE DB服务= -1检查出来是否真的发送给我邮件naavid2000@yahoo.com
(OLE DB服务= -1)
I'm working on a windows WPF application.
The thing is I have an AccessViolationException
when working with both OpenFileDialog
and OleDbConnection
objects.
Scenario: After running the application, I click on a button that display the OpenFileDialog
form in order to browse for a file. After that I'm using an OleDbConnection
in order to reference an MS Access .accdb file.
Problem: Running this scenario for the first time, everything works well, but trying to browse the file or any other file for the second time the exception occurs; it occurs after the form is opened and the file is selected.
After debugging the code, I have found that when trying to open the connection of the OleDbConnection
object [ex: dbConnecntion.Open()
] the exception occurs but if omitted it disappears, even if I'm closing the connection and disposing the resources.
Exception: AccessViolationException
>> Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
I just spent the past week trying to get rid of this same issue. Finally found this post which indicates that it's a bug in Microsoft Access Database Engine 2010 drivers. If you use the 2007 drivers instead, the problem goes away.
Take a look at:
https://connect.microsoft.com/VisualStudio/feedback/details/624503/oledb-operations-cause-accessviolationexception-during-savefiledialog?wa=wsignin1.0
And please vote for a fix - using the I can reproduce this bug and the green tick button
the key of this questiuon is "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=C:\DbTest\Test.accdb; OLE DB Services=-1" check this out if it was true send me mail naavid2000@yahoo.com
(OLE DB Services=-1)
这篇关于OpenFileDialog + OleDbConnection = AccessViolationException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!