How to transfer ASP.NET MVC Database from LocalDb to SQL Server?

前端 未结 9 1345
小鲜肉
小鲜肉 2020-12-12 17:20

I created a new ASP.NET MVC 5 project in Visual Studio 2013 (Express for Web) and by default, the project uses LocalDb as its database, but how do you transfer or mi

9条回答
  •  伪装坚强ぢ
    2020-12-12 17:31

    Got it!

    Based on @warheat1990's answer, you just have to change the connection string. But @warheat1990's answer had a little too much change. So here's my original (LocalDb) connection string:

    
    

    To connect it to SQL Server instead of LocalDB, I modified the connection string into:

    
    

    Thanks to @warheat1990 for the idea of simply changing the Web.config. My first thoughts were to identify and use the feature that VS supplies, if theres any. Because Microsoft doesnt have a concise documentation on how to do this.

提交回复
热议问题