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

前端 未结 9 1321
小鲜肉
小鲜肉 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:39

    This works for me.. Change the connection string in the web config file pointing to the database server, then run the application and register a user. Once registered successfully, go to SSMS and refresh the database and then the identity tables should appear.

    Regards

    0 讨论(0)
  • 2020-12-12 17:45

    In relation to OverLords answer, it worked perfectly for me thanks!

    If anyone is struggling with the connection string use:

        <add name="CONNECTIONSTRINGNAME" connectionString='data source= DATABASE SOURCE initial catalog=&quot;DATABASE NAME &quot;;user id=&quot;USERID&quot;;password=PASSWORD;MultipleActiveResultSets=True;' providerName="System.Data.SqlClient" />
    
    0 讨论(0)
  • 2020-12-12 17:50

    Notwithstanding this question is old, the answer didn't help me so I want to share how I solved it for my self.

    On Server Explorer, find your ASPNet DB. Then open it using SQL Server Object Explorer.

    Then go and hit Schema Compare option

    Then on the the Schema Compare window for the Target database, select the SQL Server data base you want the ASPNet DB to integrate to. Then hit Compare button

    Deselect all Delete actions for the target database, and leave selected all Add actions for the ASPNet DB, then hit Update button.

    Finally, update your connection string so it points to your SQL Server DB

    0 讨论(0)
提交回复
热议问题