“无法打开使用您的应用程序的先前版本创建的数据库"显示VB.NET程序何时尝试使用OleDBConnection打开MDB文件 [英] "Cannot open a database created with a previous version of your application" shows when VB.NET program tried to open a MDB file using OleDBConnection

查看:248
本文介绍了“无法打开使用您的应用程序的先前版本创建的数据库"显示VB.NET程序何时尝试使用OleDBConnection打开MDB文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在32位Windows 7操作系统中使用VB.NET创建了一个软件.

I have created a software using VB.NET in a 32-bit Windows 7 OS.

其中包含以下代码行:

 Dim cn As New OleDbConnection
 cn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & fileNameStr & ";Jet OLEDB:Database Password=xxxxxxx"
 cn.Open()

代码打开受密码保护的MDB文件(Microsoft Access文件).

The codes open a MDB file (Microsoft Access file) protected by a password.

当我在计算机上运行该软件时,它运行良好.

When I run the software in my computer, it works well.

但是,当在另一台计算机上对其进行测试时,会出现一条错误消息,提示无法打开使用先前版本的应用程序创建的数据库."

However, when it is tested in another computer, an error message appears saying "Cannot open a database created with a previous version of your application."

该错误消息显示在第三行代码之后.

The error message is shown after the third line of code.

您能建议我的错误在哪里以及如何解决该问题.

Could you suggest where my mistakes are and how do I resolve the problem.

谢谢.

推荐答案

当我在计算机上运行该软件时,它运行良好.

When I run the software in my computer, it works well.

但是,当在另一台计算机上对其进行测试时,会出现一条错误消息,提示无法打开使用先前版本的应用程序创建的数据库."

However, when it is tested in another computer, an error message appears saying "Cannot open a database created with a previous version of your application."

当不同的计算机安装了不同版本的Access Database Engine时,可能会发生这种情况.具体来说,如果出现错误消息,则

This can happen when the different machines have different versions of the Access Database Engine installed. Specifically, the error message will appear if

  • .mdb文件为Access 97格式,并且
  • 该计算机具有Access数据库引擎的Access 2013(或更高版本).

Access 2013删除了对Access 97文件格式的支持.

Access 2013 removed support for the Access 97 file format.

如果您的连接字符串包含

This can be slightly confusing if your connection string contains

Provider=Microsoft.ACE.OLEDB.12.0

因为Access数据库引擎的Access 2007(12.0),Access 2010(14.0)和Access 2013(15.0)版本都在"12.0"名称下注册提供程序以提供一定程度向后兼容性.因此,对于使用Access 2007+的任何给定计算机,您可以指定

because the Access 2007 (12.0), Access 2010 (14.0), and Access 2013 (15.0) versions of the Access Database Engine all register the provider under the "12.0" name to offer some degree of backward compatibility. So for any given machine with Access 2007+ on it you may specify

Microsoft.ACE.OLEDB.12.0

但是您实际使用的是

Microsoft.ACE.OLEDB.12.0
Microsoft.ACE.OLEDB.14.0在Access 2010机器上
Microsoft.ACE.OLEDB.15.0在Access 2013计算机上

Microsoft.ACE.OLEDB.12.0 on an Access 2007 machine
Microsoft.ACE.OLEDB.14.0 on an Access 2010 machine
Microsoft.ACE.OLEDB.15.0 on an Access 2013 machine

这就是为什么相同的第三方应用程序可以在一台计算机(安装了Access 2007或2010)上但无法在另一台计算机(安装了Access 2013)上打开.mdb文件的原因.

That is why the same third-party application can open an .mdb file on one machine (with Access 2007 or 2010 installed) but not on another machine (with Access 2013 installed).

这篇关于“无法打开使用您的应用程序的先前版本创建的数据库"显示VB.NET程序何时尝试使用OleDBConnection打开MDB文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆