<pre lang="c#"> private void BackUp(string strfilename) { using (SqlConnection con = new SqlConnection(fis.connectstr)) { string command = "BACKUP DATABASE Ast-db TO DISK='" + strfilename + "'"; con.Open(); using (SqlCommand cmd = new SqlCommand()) { cmd.CommandText = command; cmd.Connection = con; cmd.CommandType = CommandType.Text; int r = cmd.ExecuteNonQuery(); if (r > 0) { MessageBox.Show("BackUp ok !!!!!!!!! "); } this.Cursor = Cursors.Default; con.Close(); } }
string path="D:/filename.bak"; SqlCommand cmd=new SqlCommand("backup database dbnameto disk='"+path+"'",con); int a=cmd.ExecuteNonQuery();
BACKUP DATABASE [Ast-db] TO DISK
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)