views:

21

answers:

1

Hello,

I want to backup my database using Linq to SQL:

 Dim sql As String = "BACKUP DATABASE SeaCowDatabase TO DISK = _ 
 '" + sfd.FileName + "'"
 db.ExecuteCommand(sql)

But instead, I get this error:

System.Data.SqlClient.SqlException (0x80131904): Could not locate entry in sysdatabases for database 'SeaCowDatabase'. No entry found with that name. Make sure that the name is entered correctly. BACKUP DATABASE is terminating abnormally. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at System.Data.Linq.SqlClient.SqlProvider.Execute(Expression query, QueryInfo queryInfo, IObjectReaderFactory factory, Object[] parentArgs, Object[] userArgs, ICompiledSubQuery[] subQueries, Object lastResult) at System.Data.Linq.SqlClient.SqlProvider.ExecuteAll(Expression query, QueryInfo[] queryInfos, IObjectReaderFactory factory, Object[] userArguments, ICompiledSubQuery[] subQueries) at System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query) at System.Data.Linq.DataContext.ExecuteCommand(String command, Object[] parameters) at SeaCow.Main.Ribbon_Save_Click(Object sender, EventArgs e) in C:\Users\Daniel\My Programs\Visual Basic\SeaCow\SeaCow\SeaCow\Main.vb:line 595

Anyone have any suggestions?

+1  A: 

Make sure about these things:

  1. This database actually exists
  2. The login and user that you use have rights to backup database
Andrey
I know the database exists since my program retrieves and stores information from it. I am not sure about the login part.
Daniel