Sql 紧凑安装

发布于 2024-08-08 14:49:22 字数 176 浏览 3 评论 0原文

有什么方法可以让我们以编程方式查找是否安装了 SQL Compact...实际上我需要知道 PC 中是否安装了紧凑版,以便我可以包含或排除 SQL Compact dll...因为在我的应用程序中,有不同的进程访问相同的 .sdf 文件,如果包含这些 dll 并安装了紧凑型文件,这将导致访问冲突错误...

有什么想法吗?

Is there any way by which we can find programmatically whether SQL Compact is installed or not... Actually I need to know whether the compact edition is installed or not in PC and so that I can include or exclude the SQL Compact dll... Because in my application there are different process that access the same .sdf file which will cause Access Violation error if those dll are included and compact is installed...

Any ideas?

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

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

发布评论

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

评论(2

不如归去 2024-08-15 14:49:22

我认为注册表检查是相当可靠的。

命令

reg query "HKLM\SOFTWARE\Microsoft\Microsoft SQL Server Compact Edition\v3.5"

输出

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server Compact Edition\v3.5
    InstallDir    REG_SZ    C:\Program Files\Microsoft SQL Server Compact Edition\v3.5\
    Version    REG_SZ    3.5.5692.0
    NativeDir    REG_SZ    C:\Program Files\Microsoft SQL Server Compact Edition\v3.5\
    ServicePackLevel    REG_DWORD    0x1

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server Compact Edition\v3.5\ENU
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server Compact Edition\v3.5\GAC

您没有提及您正在使用的编程语言,但如果您想从 . NET,请使用 Microsoft.Win32.Registry API 。

I would assume a registry check is pretty reliable.

Command

reg query "HKLM\SOFTWARE\Microsoft\Microsoft SQL Server Compact Edition\v3.5"

Output

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server Compact Edition\v3.5
    InstallDir    REG_SZ    C:\Program Files\Microsoft SQL Server Compact Edition\v3.5\
    Version    REG_SZ    3.5.5692.0
    NativeDir    REG_SZ    C:\Program Files\Microsoft SQL Server Compact Edition\v3.5\
    ServicePackLevel    REG_DWORD    0x1

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server Compact Edition\v3.5\ENU
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server Compact Edition\v3.5\GAC

You didn't mention the programming language you're using, but if you want to do this from .NET, use the Microsoft.Win32.Registry APIs.

自由如风 2024-08-15 14:49:22

执行此操作的最佳方法是使 SQL Compact 成为安装过程的要求,如果未安装,则告诉用户他们需要安装它。您可以通过在项目的发布部分将其设置为先决条件来添加检查特性。显然,您可以通过检查 SC 的默认安装路径来手动编码,但这不是最可靠的方法。

The best way to do this is to make SQL Compact a requirement of your install process and if its not installed tell the user that they need to install it.You can add the check by setting it as a Prerequisite in the publish section of your projects properties. You can code this manually obviously by checking the default install path for SC but its not the most reliable way.

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