I am trying to make a backup file using this :
SqlConnection con = new SqlConnection(connection.ConnectionString);
string fname = ofd.FileName + DateTime.Now.ToString("ddMMyyyy") + " - " +
DateTime.Now.ToString("ss-mm-hh");
con.Open();
SqlCommand cmd = new SqlCommand(@"backup database [" + System.Windows.Forms.Application.StartupPath + "\\ManageArtsDB.mdf] to disk ='" + fname + ".bak'with init,stats=10", con);
cmd.ExecuteNonQuery();
con.Close();
MessageBox.Show("Backup database was successfull", "Back", MessageBoxButtons.OK, MessageBoxIcon.Information);
The error i get : System.Data.SqlClient.SqlException: "Database" 'C:\Users\Khalid\Desktop\ManageTrainingArtsF\ManageTrainingArts\bin\Debug\ManageArtsDB.mdf' does not exist. Make sure that the name is entered correctly.
the database ManageArtsDB.mdf exist :( but it say its not !