Click here to Skip to main content
15,881,852 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
I have a connection string for Entity framework with sql authentication
<add name="Entities" connectionString="metadata=res://*/Model.csdl|res://*/Model.ssdl|res://*/Model.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=MA000XSXXXXX\Sample;Initial Catalog=Test;User ID=temp;Password=temp;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient"/>
While running the application i was ended up with this error
Error:
The underlying provider failed on Open.
While googling i found that trying to connect the database through sql authentication may lead up to this error.But I have only windows authentication access to my database.
So i want to convert the above connection string to access the database using windows authentication.

I tried removing the userid and password attribute from the connection string, but the error still persist.

Please help
Thanks in advance!!!
Posted
Updated 16-Sep-12 20:25pm
v2

1 solution

Happy sighs!!!

Ha ha ha, I forgot to add the windows authentication attribute
Trusted_Connection=Yes;
or
Integrated Security=SSPI;
to my connection string, sometimes I let the stress to win :(
Now i got rid of the error be adding the Trusted_Connection attribute to my connection string and removed credentials details.
<add name="Entities" connectionString="metadata=res://*/Model.csdl|res://*/Model.ssdl|res://*/Model.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=MA000XSXXXXX\Sample;Initial Catalog=Test; Trusted_Connection=Yes; MultipleActiveResultSets=True&amp;quot;" providerName="System.Data.EntityClient"/>

Now it works good.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900