davidegironi/dentned

Database connection error :/

Closed this issue · 3 comments

I know the problem is its from my configuration but please can you help me ?
Im not sure what to write in ;data source
<add name="dentnedEntities" connectionString="metadata=res://*/Entity.Model_dentned.csdl| res://*/Entity.Model_dentned.ssdl| res://*/Entity.Model_dentned.msl; provider=System.Data.SqlClient; provider connection string=&quot;data source=DESKTOP-CV8JH9R\SQLEXPRESS;initial catalog=dentend;persist security info=True; user id=admin;password=admin; MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />

Hello @jakupi1,
starting from the connection string you can find in the configuration file of the release bin.

<add name="dentnedEntities" connectionString="metadata=res://*/Entity.Model_dentned.csdl|res://*/Entity.Model_dentned.ssdl|res://*/Entity.Model_dentned.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=DATASOURCE;initial catalog=INITIALCATALOG;user id=USERID;password=PASSWORD;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />

DATASOURCE is your server name
INITIALCATALOG your database name
USERID your database username
PASSWORD your database username password

Your config string seems fine to me, except i would recomend to omit "persist security info=True;"
You could check using SSMS if you can connect to DESKTOP-CV8JH9R\SQLEXPRESS using SQL Server authentication, and your username and password.
Or, you can change you Connection String in order to connect using the windows user, not the sql user (admin in your case).

Should be something like this:
<add name="dentnedEntities" connectionString="metadata=res://*/Entity.Model_dentned.csdl|res://*/Entity.Model_dentned.ssdl|res://*/Entity.Model_dentned.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=DATASOURCE;initial catalog=INITIALCATALOG;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />

Let me know if it works.

I tried with windows authentication and it works thank you so much!