Sql 紧凑安装
有什么方法可以让我们以编程方式查找是否安装了 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为注册表检查是相当可靠的。
命令
reg query "HKLM\SOFTWARE\Microsoft\Microsoft SQL Server Compact Edition\v3.5"
输出
您没有提及您正在使用的编程语言,但如果您想从 . 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
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.
执行此操作的最佳方法是使 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.