C
C
CJDmitry2017-01-04 09:13:21
ASP.NET
CJDmitry, 2017-01-04 09:13:21

MS SQL connection string example for ASP .Net MVC?

Good day!
If you don't mind, please show an example of MS SQL DB connection string for ASP .Net MVC. I'm interested in the connection string already on the hosting, for example "reg.ru"

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
SergioSolo, 2019-10-24
@SergioSolo

Suddenly, someone needs to configure the connection string to Reg.ru, the Web.Release.config file is not picked up by the server and you need to change the root Web.config.
According to their manual , when using EntityFramework, you need to use the line configured on the EntityClient:

<add name="DefaultConnection" 
     connectionString="metadata=res://*/;provider=System.Data.SqlClient;
                       provider connection string=&quot;
                       Data Source=localhost;
                       Initial Catalog=<db name>;
                       integrated security=False;
                       App=EntityFramework;
                       User ID=<username>;
                       Password=<password>&quot;" 
      providerName="System.Data.EntityClient" />

Surprisingly, my personal project uses EntityFramework version 6.0.0.0, but the connection worked as a SqlClient connection in the form:
<add name="DB_nameProject" providerName="System.Data.SqlClient"
      connectionString="Data Source=localhost;
           Initial Catalog=u04732352_DB_nameOnServer;
           Integrated Security=false;
           User Id=u04732352_root;
           Password=pass1234;"/>

I know it's late, but it might come in handy.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question