问题运行SQL脚本在C#中创建备份 [英] problem runnig a SQL script to create backup in C#
本文介绍了问题运行SQL脚本在C#中创建备份的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,由于SQL2008不再支持,我在VS2010/SQLServer 2008中使用以下代码时遇到问题
Hi guys, I have problem using the following code in VS2010/SQLServer 2008 since SQL2008 no longer supports
using Microsoft.SqlServer.Management.Smo;<br />
using Microsoft.SqlServer.Management.Common
string sqlConnectionString = "Data Source=(local);Initial Catalog=AdventureWorks;Integrated Security=True";
FileInfo file = new FileInfo("C:\\myscript.sql");
string script = file.OpenText().ReadToEnd();
SqlConnection conn = new SqlConnection(sqlConnectionString);
Server server = new Server(new ServerConnection(conn));
server.ConnectionContext.ExecuteNonQuery(script);
那我该怎么办呢?
谢谢
K
how should I do thid then?
Thanx
K
推荐答案
^ ]并得到以下几个信息:
备份和还原SQL数据库 [对相似事物的讨论 [ ^ ]
如有需要,请使用搜索结果.
Just did this[^] and got these few:
Backup and restore SQL databases[^]
Discussion on similar thing[^]
If needed, please use search result.
这篇关于问题运行SQL脚本在C#中创建备份的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文