我想備份使用LINQ to SQL我的數據庫:VB.NET - SQLEXCEPTION:找不到在sysdatabases中條目的數據庫
Dim sql As String = "BACKUP DATABASE SeaCowDatabase TO DISK = _
'" + sfd.FileName + "'"
db.ExecuteCommand(sql)
但是,相反,我得到這個錯誤:
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
任何人有任何建議?
這可能是一個權限問題的登錄名和用戶。我會驗證你可以先從你的程序訪問數據庫。 – buckbova 2010-07-13 17:03:05
我可以通過我的程序訪問數據庫。 – 2010-07-13 17:04:55
接下來的問題是爲什麼在世界上你會用.net來備份數據庫。這可以是一個工作在SQL框或甚至一個存儲過程。讓數據庫處理數據。 – JonH 2010-07-13 17:13:35