I have a program, which connects to the SQLServer 2005 *.mdf file. I
need to add backup/restore database function to my program.
Try to do:
SqlConnection greenTourConnection = new
SqlConnection(GreenTour.Properties.Settings.Defaul t.GreenTourConnectionString);
SqlCommand hotelList = greenTourConnection.CreateCommand();
hotelList.CommandText = @."BACKUP DATABASE GreenTourDataBase TO DISK =
'C:\GreenTourDataBase.bak'";
greenTourConnection.Open();
hotelList.ExecuteNonQuery();
greenTourConnection.Close();
Says: System.Data.SqlClient.SqlException: Could not locate entry in
sysdatabases for database 'GreenTourDataBase'. No entry found with
that name. Make sure that the name is entered correctly.
But the name is printed correctly. Can anyone please help?
Hi
Can you show us printed script?
"radandri" <radandri@.gmail.com> wrote in message
news:1171875188.289749.322570@.p10g2000cwp.googlegr oups.com...
>I have a program, which connects to the SQLServer 2005 *.mdf file. I
> need to add backup/restore database function to my program.
> Try to do:
> SqlConnection greenTourConnection = new
> SqlConnection(GreenTour.Properties.Settings.Defaul t.GreenTourConnectionString);
> SqlCommand hotelList = greenTourConnection.CreateCommand();
> hotelList.CommandText = @."BACKUP DATABASE GreenTourDataBase TO DISK =
> 'C:\GreenTourDataBase.bak'";
> greenTourConnection.Open();
> hotelList.ExecuteNonQuery();
> greenTourConnection.Close();
> Says: System.Data.SqlClient.SqlException: Could not locate entry in
> sysdatabases for database 'GreenTourDataBase'. No entry found with
> that name. Make sure that the name is entered correctly.
> But the name is printed correctly. Can anyone please help?
>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment