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

VulpesRank #55 · 29.2K reputationPosted May 22, 2012, 1:39 AM EDT
VulpesRank #55 · 29.2K reputationPosted May 21, 2012, 10:54 AM EDT
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.
Guest UserRank #4,868 · 321 reputationPosted May 22, 2012, 12:01 AM EDT
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