需要 C# SQL Server 2008 中 SMO 的参考代码
我用 google 搜索,但找不到正确的简单代码来使用完整备份数据库并恢复备份,使用 C# 使用默认值。
我正在使用 C# Visual Studio 2008 和 SQL Server 2008 R2 评估,但我想 SQL Server 2005 和 C# 也可以工作。
微软网站没有相关代码,它只显示 Microsoft.SqlServer.Management.Smo
命名空间的描述......
I googled but cannot find proper simple code for using backup database full and restore the backup, using defaults by using C#.
I am using C# Visual Studio 2008 and SQL Server 2008 R2 evalution but I guess SQL Server 2005 and C# will work too.
The Microsoft site doesn't have code regarding it, it only show description of Microsoft.SqlServer.Management.Smo
Namespace......
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
MSDN 有一个主题SMO 入门,涵盖了很多内容 -还有一个名为编程特定任务的主题,它展示了如何执行某些常见操作使用 SMO 在 C# 中执行任务。
还有一整套在 SQL Server 2005 中开始使用 SMO,这些内容仍然非常有用这在很大程度上适用于 SQL Server 2008 和 2008 R2 版本。
这是另一篇SQL Server 管理对象 (SMO) 入门文章,可帮助您入门加快速度。
MSDN has a topic Getting Started in SMO that covers a lot of ground - there's also a topic called Programming Specific Tasks which shows how to do certain common tasks in C# with SMO.
And there's a whole series of Getting Started with SMO in SQL Server 2005 which still very much applies to the 2008 and 2008 R2 versions of SQL Server.
Here's another Getting started with SQL Server Management Objects (SMO) article to get you up to speed.
这是一个使用 VB.NET 的示例
http://msdn.microsoft.com/en -us/library/microsoft.sqlserver.management.smo.restore.aspx
您可以使用转换器来获取 C#:
http://www.developerfusion.com/tools/convert/csharp-to- VB/
Here is an example with VB.NET
http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.management.smo.restore.aspx
You can use a converter to get C#:
http://www.developerfusion.com/tools/convert/csharp-to-vb/