I have the following connection string in my Web.Config which was automatically generated with my Entity Framework and SQL Database setup. The first part is the Entity Framework map and the second is the SQL Database map.
connectionString="metadata=res://*/DataAccess.DC.csdl|res://*/DataAccess.DC.ssdl|res://*/DataAccess.DC.msl;provider=System.Data.SqlClient;
provider connection string= Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\DCECommerceDB.mdf;Integrated Security=True;
User Instance=True;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient"/>
My question is, im not sure as to why the provider keyword is present before the connection string of the SQL Database map, is this really needed?
Regards
Steven
My question is, im not sure as to why the provider keyword is present before the connection string of the SQL Database map, is this really needed?
Regards
Steven
3 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted May 22, 2012, 5:39 AM
Guest UserPosted May 22, 2012, 4:01 AM
In the event that I wish to change the SQL Connection string to match that of a given string from a hosted provider, I assume it should be a simple case of replacement ie:-
// Existing string
// Hosting provider string
Data Source=newhostingserver; Initial Catalog=dbname; User ID=username; Password='password';
// New connection string
Regards
VulpesPosted May 21, 2012, 2:54 PM
If the second string were not prefixed by 'provider', then I suppose you could still tell the difference because 'connection string' is two words in the second string and one word in the first string but the prefix makes the purpose of the second string clearer.