How to backup database (SQL Server 2008) in C# without using SMO?

You need to assign that SqlConnection object to the SqlCommand - try this code: if (saveFileDialog1.ShowDialog() == DialogResult. OK) { string connStr = "Data Source=M1-PC;Initial Catalog=master;Integrated Security=True;Pooling=False"; using(SqlConnection conn = new SqlConnection(connStr)) { string sqlStmt = String. Format("BACKUP DATABASE LA TO DISK='{0}'", saveFileDialog1.

FileName); using(SqlCommand bu2 = new SqlCommand(sqlStmt, conn)) { conn.Open(); bu2.ExecuteNonQuery(); conn.Close(); MessageBox. Show("ok"); } } }.

When I use your code I get this error messege, i44.tinypic. Com/5mbhxx. Png - What is the proplem?

– SzamDev Apr 11 '10 at 19:17 1 Well, does your SQL Server really have a directory C:\Users\Saleh\Documents? Remember: the backup will be done on the SQL Server machine - it will NOT be to your own local PC! – marc_s Apr 11 '10 at 20:17.

. Either set the Connection property or use SqlConnection. CreateCommand to create the command in the first place.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions