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.Default.GreenTourConnectionStrin
g);
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.googlegroups.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.Default.GreenTourConnectionStr
ing);
> 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?
>|||Are you 1005 certain that you have connected to the correct SQL Server insta
nce and that you have
spelled the database name correctly?
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"radandri" <radandri@.gmail.com> wrote in message
news:1171875188.289749.322570@.p10g2000cwp.googlegroups.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.Default.GreenTourConnectionStr
ing);
> 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