Change database instance

Asked

Viewed 100 times

0

I am doing a project in MVC and my problem is that my database is automatically created in the "localdb" instance, but I wanted it to be created in my instance that I created in SQL Server.

Is there a possibility to change this? And if there is, I can change right away when I create the project?

  • 1

    From what I understand you have to fix your Connection string, put it in the question to see how it is set and help edit it for you

  • Just change it on the web.config

  • My problem is just this, before when I create the project, it creates me the database on localdb and the web config has no string Connection, and it creates in the same database, I mean, if I put the Connection string to sqlserver as soon as I start the project, it won’t create me in localdb but in sqlserver? because what I did was this, I created the templates and generated the views and went to see in which of the instances he had created the database and only then put the Connection string in webconfig, ie always had two databases equal one in each instance and sometimes

1 answer

0


Open the file web.config and look for the section connectionStrings.

There will probably have a tag add containing the string connection pointing to Localdb.

Change it to look like this - obviously you will need to use your SQL Server connection data.

<connectionStrings>
    <add name="DefaultConnection" 
       connectionString="Server=.\SQLEXPRESS;Initial Catalog=Nome-Banco;Uid=User;Pwd=Senha;PersistSecurityInfo=True" 
       providerName="System.Data.SqlClient" />
</connectionStrings>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.