如何使用 C# 代码在 SQL Server 2008 R2 中启用文件流
我为我的 wpf 应用程序创建了一个安装文件,它将在客户端计算机上安装 .net Framework 4 和 sql server 2008R2。
但是,在我的 C# 代码中运行 sql 脚本之前,我需要在我的计算机上的 Microsoft SQL Sever 2008 R2/配置工具中启用文件流。
我需要一种在 C# 代码中执行此操作的方法,而不是手动执行此操作。
我已尝试以下
操作
:从页面 http:// /www.mssqltips.com/tip.asp?tip=1838 但它不起作用。
谢谢并致以最诚挚的问候!
I have a setup file created for my wpf application which will install the .net framework 4 and sql server 2008R2 on a client machine.
However before running the sql script in my c# code I need to enable file stream in Microsoft SQL Sever 2008 R2/ Configuration tools on the my machine.
I need a way of doing it in c# code rather than doing it manually.
I have tried the following:
Enable FILESTREAM Feature Using Transact SQL (TSQL)
from page, http://www.mssqltips.com/tip.asp?tip=1838 but it didnt work.
Thanks and Best Regards!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
通常,对于通过 .net 代码对 SQL Server 进行任何管理,您应该查看 SQL Server Management对象。它可能支持在数据库级别启用 FILESTREAM,但我不确定。
如果它有任何帮助,您至少可以创建一个启用新的 FILESTREAM FileGroup< /a> 通过 API。该 MSDN 页面上有一个示例,此外,如果您通过 google smo filestream 搜索,还可以找到一些博客示例。
Generally for any administration of SQL Server through .net code you should be looking at SQL Server Management Objects. It may support enabling FILESTREAM at the DB level, but I'm not sure.
If it's of any help you are however at least able to create a new FILESTREAM enabled FileGroup through the api. An example exists on that MSDN page, plus there are some blog samples out there if you google smo filestream.
调用此函数。
重启instanceName对应的系统服务。
如果instanceName是SQLEXPRESS,那么服务名称将为
MSSQL$SQLEXPRESS。重新启动可以通过系统控制台或其他方式完成。
3.1 sc 停止“MSSQL$SQLEXPRESS”
3.2 等待停止(检查服务状态:sc query "MSSQL$SQLEXPRESS")..
3.3 sc start "MSSQL$SQLEXPRESS"
Call this function.
Restart system service corresponding to the instanceName.
If instanceName is SQLEXPRESS, then service name will be
MSSQL$SQLEXPRESS. Restarting can be done by system console, or by another way.
3.1 sc stop "MSSQL$SQLEXPRESS"
3.2 Wait until it is stopped (check service state: sc query "MSSQL$SQLEXPRESS")..
3.3 sc start "MSSQL$SQLEXPRESS"