Click here to Skip to main content
15,887,083 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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);


how should I do thid then?
Thanx

K
Posted

1 solution

Just did this[^] and got these few:
Backup and restore SQL databases[^]
Discussion on similar thing[^]

If needed, please use search result.
 
Share this answer
 
Comments
mrkeivan 4-Sep-10 11:39am    
Dear friend, if you pay close attention my question aint how, because i already know how to do it, it's how to implement it for SQL 2008 !?
Sandeep Mewara 4-Sep-10 13:06pm    
http://www.microsoftbible.com/backup-recover-database-c-sql-dmo-sql-server.html

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900