如何以编程方式启用sql协议c# [英] How to enable sql protocol programitically c#
本文介绍了如何以编程方式启用sql协议c#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要一个代码,以编程方式启用 SQL协议
,例如( Tcp / Ip,命名管道,VIA ),可以在 SQL配置管理器
。任何人都可以帮我一段代码片段。
可能的答案 [ ^ ]
以上是我在网上搜索时发现的链接,但不知道填写什么实例名称和服务器名称
提前致谢
I need a code that programitically enables SQL Protocol
such as (Tcp/Ip,Named Pipes,VIA) which can be found in SQL configuration Manager
. Can anyone help me with a piece of code snippet.
Possible Answer[^]
above is a link i found while searching on the internet but do not know what to fill in instance name and server name
Thanks in advance
推荐答案
您可以尝试在HKLM \Software \更改注册表值Microsoft \ Microsoft SQL Server \ MSSQL10_50.MSSQLSERVER \ MSSQLServer \SuperSocketNetLib
。服务器名称可能会有所不同。
或者,您可以使用WMI - System.Management命名空间 [ ^ ]。
这是一个例子 - 使用WMI以编程方式配置别名 [ ^ ]。
您可以通过可以从C#启动的powerscript来实现这一点 - 启用或禁用服务器网络协议 [ ^ ]。
You could try changing the registry value atHKLM\Software\Microsoft\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQLServer\SuperSocketNetLib
. The server name might vary.
Alternately, you could use WMI - System.Management Namespace[^].
Here is an example - Configure Aliases Programmatically Using WMI[^].
You can do this though a powerscript that can be launched from C# - Enable or Disable a Server Network Protocol[^].
这篇关于如何以编程方式启用sql协议c#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文