1
<connectionString>
  <add name="SchoolContext"
       connectionString="Data Source=(local); database=Sample; integrated security=true;"
       providerName="System.Data.SqlClient"      
   />

Above is my connection string. But when I run application it gives an error named:

The configuration section 'connectionString' cannot be read because it is missing a section declaration

How can I fix it?

2 Answers 2

6

There should be <connectionStrings>...</connectionStrings> not <connectionString>...

See www.connectionstrings.com for details about various configurations.

Sign up to request clarification or add additional context in comments.

1 Comment

oh!! I didn't noticed at all. Thanks a lot @Giorgi Nakeuri
1

http://www.connectionstrings.com/sql-server-2012/

Try this connectionstring style

Server=(localdb)\v11.0;Integrated 
Security=true;AttachDbFileName=C:\MyFolder\MyData.mdf;Trusted_Connection=Yes;

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.