The underlying provider failed on Open in entity framework connection

c# connection-string entity-framework

Question

i use Entity framework in .net 4 and use this connection in project:

<add name="Database1Entities" connectionString="metadata=res://*/Model.Model1.csdl|res://*/Model.Model1.ssdl|res://*/Model.Model1.msl;provider=System.Data.SqlClient;pr  ovider connection string=&quot;Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirector  y|\Database1.mdf;initial catalog=Database1;Integrated Security=True;User Instance=True;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />

and show this error:

The underlying provider failed on Open.

1
1
8/10/2013 12:29:46 PM

Popular Answer

I don't know why you get this error but I use this connection string and I don't have any problem. remember the name of the DbContext class and connection string should be same

<add name="MyDB"
     connectionString="Server=127.0.0.1;User ID=sa;Password=password;Database=Database"
     providerName="System.Data.SqlClient"/>

2
8/10/2013 12:32:07 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow