Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialpurva mishra
Courses Plus Student 125 PointsIn App.config set the "Context" database connection string's Data Source value to the SQL Server LocalDB default instanc
In App.config set the "Context" database connection string's Data Source value to the SQL Server LocalDB default instance name.,
i have set the datasource value to (localdb)\MSSQLLocaldb , still its throwing me error : (did you include suffix (localdb)
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="mssqllocaldb" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
<connectionStrings>
<add name="Context"
connectionString="Data Source=(localdb)\MSSQLLocaldb;Initial Catalog=;Integrated Security=True;MultipleActiveResultSets=True"
providerName="System.Data.SqlClient"/>
</connectionStrings>
</configuration>
3 Answers
Steven Parker
231,248 PointsThe instance name is case-sensitive.
You wrote "MSSQLLocaldb" (little "db") instead of "MSSQLLocalDB" (capital "DB").
S.Amir Nahravan
4,008 PointsI think you have to write (localdb)\MSSQLLocalDB
Steven Parker
231,248 PointsWow, what a long-delay echo there is in here!
Asaad Khattab
38,121 PointsYou forgot to capitalize DB => MSSQLLocalDB
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="mssqllocaldb" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
<connectionStrings>
<add name="Context"
connectionString="Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=;Integrated Security=True;MultipleActiveResultSets=True"
providerName="System.Data.SqlClient"/>
</connectionStrings>
</configuration>