What
needs to be done with this to get things working? Oh, by the way, I know that the userid and password are correct but that is not what is in the above statement.
Unless you're using the EF Designer, you need System.Data.SqlClient instead of EntityClient (assuming you're using SQL Server). If you are using the Designer, the format of the string is very different and should have been generated by the designer. See
this page:
Which development approach are you using -- code first, database first, or model first? If it's one of the latter two you need to use a connection string that the designer generates and which looks something like this:
In the Web.config file, the provider name is not part of the connection string. If you're not using the designer (if you don't have an .edmx file), the connection string should look like this:
eric2820
Contributor
2777 Points
1161 Posts
The connection string 'EFDbContext' in the application's configuration file does not contain the ...
Nov 14, 2012 07:50 PM|LINK
My connection string is:
connectionString="Data Source=GEMSFAMILY\GEMSFAMILY;Initial Catalog=My-MSI.Net;User ID=userid;Password=password;providerName=System.Data.EntityClient" />
What needs to be done with this to get things working? Oh, by the way, I know that the userid and password are correct but that is not what is in the above statement.
http://www.my-msi.net/Admin
blog
If a post helps you, please mark it as Ansered, thank-you.
tdykstra
Contributor
4446 Points
622 Posts
Microsoft
Moderator
Re: The connection string 'EFDbContext' in the application's configuration file does not contain ...
Nov 14, 2012 07:59 PM|LINK
Unless you're using the EF Designer, you need System.Data.SqlClient instead of EntityClient (assuming you're using SQL Server). If you are using the Designer, the format of the string is very different and should have been generated by the designer. See this page:
http://msdn.microsoft.com/en-us/library/jj653752.aspx
eric2820
Contributor
2777 Points
1161 Posts
Re: The connection string 'EFDbContext' in the application's configuration file does not contain ...
Nov 14, 2012 08:06 PM|LINK
Well with this connection string it still didn't work:
connectionString="Data Source=GEMSFAMILY\GEMSFAMILY;Initial Catalog=My-MSI.Net;User ID=userid;Password=password;providerName=System.Data.SqlClient" />
http://www.my-msi.net/Admin
blog
If a post helps you, please mark it as Ansered, thank-you.
tdykstra
Contributor
4446 Points
622 Posts
Microsoft
Moderator
Re: The connection string 'EFDbContext' in the application's configuration file does not contain ...
Nov 14, 2012 08:09 PM|LINK
What is the error you're getting? Also, for SQL Server you generally need to add ";MultipleActiveResultSets=true" to the end of the string.
eric2820
Contributor
2777 Points
1161 Posts
Re: The connection string 'EFDbContext' in the application's configuration file does not contain ...
Nov 14, 2012 11:31 PM|LINK
The error I'm getting is the subject line in this message thread:
The connection string 'EFDbContext' in the application's configuration file does not contain the required providerName attribute."
The connection string is:
connectionString="Data Source=GEMSFAMILY\GEMSFAMILY;Initial Catalog=My-MSI.Net;Persist Security Info=True;User ID=userid;Password=password;ProviderName=System.Data.SqlClient;MultipleActiveDataSets=true"
http://www.my-msi.net/Admin
blog
If a post helps you, please mark it as Ansered, thank-you.
tdykstra
Contributor
4446 Points
622 Posts
Microsoft
Moderator
Re: The connection string 'EFDbContext' in the application's configuration file does not contain ...
Nov 14, 2012 11:56 PM|LINK
Which development approach are you using -- code first, database first, or model first? If it's one of the latter two you need to use a connection string that the designer generates and which looks something like this:
<add name="ConnectionStringName" providerName="System.Data.EntityClient" connectionString="metadata=res://*/ ContextClass.csdl|res://*/ ContextClass.ssdl|res://*/ ContextClass.msl;provider=System.Data.SqlClient;provider connection string="Data Source=ServerName;Integrated Security=False;User Id=userid;Password=password;MultipleActiveResultSets=True"" />
See http://msdn.microsoft.com/en-us/data/jj592674
eric2820
Contributor
2777 Points
1161 Posts
Re: The connection string 'EFDbContext' in the application's configuration file does not contain ...
Nov 15, 2012 12:26 AM|LINK
I prefer to build the database first and then connect to it with the web project (MVC 3).
When I tried placing quotes around the providerName value, I get syntax errors in the connection string.
http://www.my-msi.net/Admin
blog
If a post helps you, please mark it as Ansered, thank-you.
tdykstra
Contributor
4446 Points
622 Posts
Microsoft
Moderator
Re: The connection string 'EFDbContext' in the application's configuration file does not contain ...
Nov 15, 2012 01:43 AM|LINK
In the Web.config file, the provider name is not part of the connection string. If you're not using the designer (if you don't have an .edmx file), the connection string should look like this:
<add name="ConnectionStringName" providerName="System.Data.SqlClient" connectionString="Data Source=ServerName;Initial Catalog=DatabaseName;Integrated Security=False;User Id=userid;Password=password;MultipleActiveResultSets=True" />