浏览时如何检查客户端是否安装了 SQLNCLI10 提供程序?

发布于 2024-10-11 03:32:39 字数 743 浏览 0 评论 0原文

我有一个 ac# 网站,它允许客户端通过使用第 3 方 ActiveX 控件绕过 Web 服务器,直接从其 PC 连接到远程 SQL Server 数据库。我最初使用的是 SQLOLEDB 提供程序,它工作正常。客户端位于内部网络中(使用 Windows 计算机和 Internet Explorer),并且该网站不适合暴露在一般互联网上。

我必须从使用 SQLOLEDB 提供程序升级到 SQLNCLI10 提供程序,以满足 SQL Server 2008 中的新数据类型。它在我的 PC 上运行,但在生产中出现故障。我没有意识到它之所以有效,是因为 SQLOLEDB 提供程序是 Windows 操作系统 (MDAC/WDAC) 的一部分,因此已经存在于客户端的 PC 上。 SQLNCLI10 提供程序作为 SQL Server 2008 的一部分包含在内,并且必须单独安装在客户端计算机上(因为大多数客户端计算机不会安装 SQL Server,但我安装了)。

我可以提供一个链接,供他们下载 独立的 Microsoft SQL Server 2008 Native Client 提供程序,但如何检查他们是否已安装它?

I have a c# website that allows a client to connect directly to a remote SQL Server database from their PC, bypassing the web server, by using a 3rd party ActiveX control. I was originally using the SQLOLEDB provider and it was working fine. The clients are in an internal network (using Windows machines and Internet Explorer) and the website is not intended for exposure to the general internet.

I had to upgrade from using the SQLOLEDB provider to the SQLNCLI10 provider to cater for the new datatypes in SQL Server 2008. It worked on my PC, but broke in production. What I didn't realise is that it worked because the SQLOLEDB provider is part of the Windows OS (MDAC/WDAC) so already exists on the client's PC. The SQLNCLI10 provider is included as part of SQL Server 2008 and has to be installed separately on the client machine (because most of them won't have SQL Server installed, but I do).

I can provide a link for them to download a standalone Microsoft SQL Server 2008 Native Client provider from, but how do I check if they already have it installed?

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

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

发布评论

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

评论(2

青衫儰鉨ミ守葔 2024-10-18 03:32:39

令人沮丧的是,对于如何测试客户端库是否存在,微软似乎没有给出明确的答案。 Web 搜索和注册表嗅探至少揭示了以下注册表项:

HLKM\SOFTWARE\Microsoft\SQLNCLI11 (key:InstalledVersion)
HLKM\SOFTWARE\Microsoft\SQLNCLI10 (key:InstalledVersion)
HKLM\SOFTWARE\Microsoft\Microsoft SQL Native Client\CurrentVersion (version 9, i presume?)
HLKM\SOFTWARE\Microsoft\Microsoft SQL Server Native Client 10.0\CurrentVersion (key:Version)
HLKM\SOFTWARE\Microsoft\Microsoft SQL Server Native Client 11.0\CurrentVersion (key:Version)

MSDN 上的这篇博文建议使用注册表项来回答相关问题(是否安装了 SQL Server Express)是错误的,错误的,错误的,你应该写 200 行改为 WMI 代码。 WMI 方法似乎 同样没有证件,对我来说甚至更加脆弱。

由于 Microsoft 允许重新分发 SQL Native Client 包,也许最好的选择是只需将 msi 包含在应用程序的安装程序中并运行它(无论是否需要)。请参阅他们提供的各种驱动程序的受支持操作系统列表,其中显示还有一个版本 10.5(!)。

SQLNCLI 与基于 MDAC 的驱动程序并行安装,因此在其上运行 msiexec 并让它处理细节应该是安全的。

Frustratingly, Microsoft does not seem to give an unambiguous answer on how to test whether the client library is present. Web searching and registry sniffing reveals at least the follow registry keys:

HLKM\SOFTWARE\Microsoft\SQLNCLI11 (key:InstalledVersion)
HLKM\SOFTWARE\Microsoft\SQLNCLI10 (key:InstalledVersion)
HKLM\SOFTWARE\Microsoft\Microsoft SQL Native Client\CurrentVersion (version 9, i presume?)
HLKM\SOFTWARE\Microsoft\Microsoft SQL Server Native Client 10.0\CurrentVersion (key:Version)
HLKM\SOFTWARE\Microsoft\Microsoft SQL Server Native Client 11.0\CurrentVersion (key:Version)

This blog post at MSDN suggests that using registry keys to answer a related question (is SQL Server Express installed) is wrong, wrong, wrong and you should write 200 lines of WMI code instead. The WMI approaches seem equally undocumented and even more fragile to me.

Since Microsoft allows the SQL Native Client package to be redistributed, perhaps the best choice is simply include the msi in your application's installer and run it whether it is needed or not. See this list of supported operating system for the various drivers they provide which reveals there is also a version 10.5(!).

SQLNCLI is installed in parallel to MDAC-based drivers, so it should be safe to run msiexec on this and let it take care of the details.

挽容 2024-10-18 03:32:39

简单地,检查注册表项或文件

  • 注册表:HKLM\SOFTWARE\Microsoft\Sqlncli10
  • 文件:检查\System32中的sqlncli10.dll

或者您也可以使用WMI

它可能是HKLM\SOFTWARE\Microsoft \Microsoft SQL Server\SQLNCLI10\CurrentVersion 也可以根据您的链接比较版本,例如 10.0.1600.22

Simply, check registry keys or files

  • Registry: HKLM\SOFTWARE\Microsoft\Sqlncli10
  • File: Check for sqlncli10.dll in \System32

Or you can use WMI too

It could be HKLM\SOFTWARE\Microsoft\Microsoft SQL Server\SQLNCLI10\CurrentVersion too where you can compare version eg 10.0.1600.22 as per your link

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