微軟SQLDmo 的一個小BUG,?

來源:互聯網
上載者:User
          今天在用sqlDMO做資料備份和恢複時,Cannot open backup device 。根據經驗應該是路徑輸出的有問題,仔細看了一下代碼,沒有任何問題,那就奇怪了,我在本機測試沒有問題,在測試部就出問題了;環境原因,由於我用的是V 8.5 而目標機需要測試MSDE,應該相容啊,不過還好,這個問題馬上被排除,測試機也有8.5了,納悶半分鐘,我想莫非是由於程式本身的路徑。。。。
         System.Runtime.InteropServices.COMException (0x80040C81):
[Microsoft][ODBC SQL Server Driver][SQL Server]Cannot open backup device '.\Settings\a\案頭\Release\BackUp\20080311115800RemtLvFP.BAK'. Device error or device off-line. See the SQL Server error log for more details.
[Microsoft][ODBC SQL Server Driver][SQL Server]BACKUP DATABASE is terminating abnormally.   在 SQLDMO.BackupClass.SQLBackup(_SQLServer ServerObject)
           測試機的路徑在案頭:
            
           更換路徑:C:盤
          
           總需要有個解決辦法呀:路徑問題,系統中的 .\ 和“系統硬碟”:\Documents and Settings 等價 例如:C:\Documents and Settings
            private static string SpecialReplace(string path)
           {
                  string combine = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
                  string[] paths = combine.Split('\\');
                  path = path.Replace(@".\Settings", String.Format(@"{0}\{1}", paths[0], paths[1]));
                  return path;
           }          
 這種測試和解決辦法有點醜陋,不過基本路徑是:能最快解決問題的辦法是好辦法,不過最好釜底抽薪,是否是微軟的BUG?

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.