Visual Studio 2008 上的 Sql Server Compact 2005

发布于 2024-08-20 04:57:44 字数 1260 浏览 3 评论 0原文

我正在开发一个与 SQL Server 2005 创建的 Sql Compact 数据库文件交互的 Windows 窗体应用程序。该应用程序最初是在 Visual Studio 2005 中开发的,但最近转换为 Visual Studio 2008 解决方案。

关于 Sql Compact,我们确保所有引用仍然设置为处理 2005 版 Sql Compact 而不是 Sql Compact 3.5 的程序集。完成此操作后,应用程序仍然按其应有的方式运行 - 它仍然会与 Compact 数据库交互,执行同步操作等。

但是,我今天刚刚发现 Visual Studio 工具(例如 DataSet Designer)不能很好地与 Sql 配合使用3.5 之前版本的压缩数据库文件。如果我进入“新建连接...”向导,则唯一的 Sql Compact 数据源/数据提供程序适用于 Sql Compact 3.5。我假设 Visual Studio 2008 默认情况下不包含旧版本 Sql Compact 的数据提供程序。

有没有办法将旧版本的 Sql Compact 添加到连接向导的“数据源”列表中?要准确了解我所指的内容,请单击 Visual Studio 2008 的“工具”菜单,然后单击“连接到数据库...”。在出现的窗口中,单击 < “数据源”设置旁边的“更改...”。在此对话框中,我无法选择 Sql Compact 的早​​期版本 - 只有 3.5 可用。

也许我需要在某处添加程序集引用?或者将一些文件从 Visual Studio 2005 目录复制到 2008?我认为必须有一种方法让 Visual Studio 2008 能够与 Sql Server 2005 中的 Sql Compact 数据库进行交互。

为了提供更多细节,我在访问我的 DataSet 时发现了这个问题,对吧-单击并尝试添加一个TableAdapter。出现的第一个屏幕显示“选择您的数据连接”。如果我将其设置为我们一直使用的 Sql Compact 连接,那么当单击下一步 > 按钮时,我会收到以下错误:


无法打开与数据库的连接

“所选数据库是使用早期版本的 SQL Server Compact 创建的,需要升级到 SQL Server Compact 3.5,然后才能打开或测试连接,通过创建新的数据连接并完成“添加连接”对话框来升级数据库。”

检查连接并重试。


这里唯一的问题是我们仍然使用Sql Server 2005,如果我的理解是正确的,它不会产生与Sql Compact 3.5兼容的订阅文件。如果我的这个假设是错误的,请纠正我。

非常感谢您提供的任何帮助。谢谢。

I'm working on a Windows Forms application that interacts with a Sql Compact database file created by SQL Server 2005. This application was originally developed in Visual Studio 2005 but was recently converted to a Visual Studio 2008 solution.

In regards to Sql Compact, we made sure the references were all still set to the assemblies that handle the 2005 version of Sql Compact rather than Sql Compact 3.5. Having done this, the application still runs just as it should - it will still interact with the Compact database, perform synchronization operations, etc.

However, I just discovered today that Visual Studio tools such as the DataSet Designer do not play well with a Sql Compact database file of an older version than 3.5. If I go to the New Connection... wizard, the only Sql Compact Data Source / Data Provider are for Sql Compact 3.5. I assume that Visual Studio 2008 just doesn't include the data provider for the older version of Sql Compact by default.

Is there a way you can add the old version of Sql Compact to the list of "Data Sources" for the connection wizard? To see exactly what I'm referring to, click on the Tools menu of Visual Studio 2008 and click Connect to Database... In the window that comes up, click Change... next to the Data source setting. From this dialog there is no way I can select the earlier version of Sql Compact - only 3.5 is available.

Maybe I need to add an assembly reference somewhere? Or copy some file(s) from my Visual Studio 2005 directory over to 2008? I would think there would have to be a way for Visual Studio 2008 to be able to interact with a Sql Compact database from Sql Server 2005.

To provide one more bit of detail, I discovered this problem when I went to my DataSet, right-clicked and tried to add a TableAdapter. The first screen that comes up says, "Choose Your Data Connection". If I leave it set to the Sql Compact connection that we've always used, I now get the following error when clicking the Next > button:


Failed to open a connection to the database

"The selected database was created with an earlier version of SQL Server Compact and needs to be upgraded to SQL Server Compact 3.5 before the connection can be opened or tested. Upgrade the database by creating a new data connection and completing the Add Connection dialog box."

Check the connection and try again.


The only problem here is that we still use Sql Server 2005, and if my understanding is correct, it does not produce subscription files that are compatible with Sql Compact 3.5. If I am wrong in this assumption, please correct me.

Any help you can provide is greatly appreciated. Thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

压抑⊿情绪 2024-08-27 04:57:44

尝试使用SqlCompact Engine升级方法。

SqlCeEngine en = new SqlCeEngine("--conn string");
en.Upgrade();

try using the SqlCompact Engine upgrade method.

SqlCeEngine en = new SqlCeEngine("--conn string");
en.Upgrade();
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文