TOP

[ASP.NET][SQL Server] LocalDB開啟MDB檔發生interfaces error:50 Local Database Runtime error occurred.

環境:安裝VS2015 Update2及LocalDB 後,在VS2015要開啟MDB檔時發生錯誤訊息。

問題1: LocalDB開啟MDB檔發生interfaces error:50 Local Database Runtime error occurred.

發生的訊息內容為:A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 50 - Local Database Runtime error occurred. Cannot create an automatic instance. See the Windows Application event log for error details.

(1).因電腦原本已安裝過VS2012及SQL 2012 SQL Express LocalDB,研判可能是已經有裝過LocalDB造成未自動建立(localdb)\MSSQLLocalDB的connection。

(2).在未移除SQL 2012 SQL Express LocalDB的狀況下,又直接下指令建立MSSQLLocalDB的connection,造成連結的LocalDB停留在12的版本(SQL 2012 SQL Express LocalDB)。

問題2:
雖然成功建立起MSSQLLocalDB的connection,但MDB檔案為最新的DB所建立,因此發生版本不支援的錯誤。

The database cannot be opened because it is version 851. This server supports version 782 and earlier. A downgrade path is not supported

處理方式:刪除原本建立的MSSQLLocalDB的connection,並且重新將版本更新至851(13.0)

將MSSQLLocalDB的connection變更為version to 851 (13.0)的步驟如下:
(1).Open CMD , cd to flooder of SqlLocalDB (Default : "C:\Program Files\Microsoft SQL Server\130\LocalDB\Binn")
(2).Command "SqlLocalDB.exe delete "MSSQLLocalDB"" , The instance of LocalDB will be deleted.
(3).Command "SqlLocalDB.exe create "MSSQLLocalDB"" , Then you'll see the instance of newest LocalDB version in your computer has been created.

參考網址:http://stackoverflow.com/questions/36699309/sql-local-database-cannot-be-opened































問題3:開啟連結後無法開啟MDB檔案內的Table,發生的錯誤訊息如下。
Could not load file or assembly Microsoft.SqlServer.management.sdk.sfc version 11.0.0.0

處理方式為重新安裝SharedManagementObjects.msi檔案,並且重新開啟VS2015即可。

檔案下載位置:
http://www.microsoft.com/en-us/download/details.aspx?id=42295
  • ENU\x64\SharedManagementObjects.msi for X64 OS or
  • ENU\x86\SharedManagementObjects.msi for X86 OS, 

參考網址:http://stackoverflow.com/questions/16906686/could-not-load-file-or-assembly-microsoft-sqlserver-management-sdk-sfc-version-1