I am unable to connect my database in the connection string
<p>I am a beginner in Visual Studio and in using SQL Server databases.
I have connected my SQL Server database in Server Explorer and tested the connection; it connected successfully.</p>

<p>Now I have a problem adding a row in the database using the Visual Studio coding.
I don't know how to connect to that SQL Server database using that connection string.
I am posting the images for the same.
This is the image with the coding I had used, the Text line which is coloured is </p>

<pre><code>(
    cnn.ConnectionString =
        System.Configuration.ConfigurationManager.ConnectionStrings[
            "Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-WebApplication5-20160919115911;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-WebApplication5-20160919115911.mdf "
        ].ConnectionString;
)
</code></pre>

<p><a href="https://i.stack.imgur.com/h0iHE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/h0iHE.png" alt="enter image description here"></a></p>

<p>My web.config screen shot is like this. </p>

<p><a href="https://i.stack.imgur.com/PbSva.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PbSva.png" alt="enter image description here"></a></p>

<p>The text in the connection string is</p>

<pre><code>(    &lt;add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-WebApplication5-20160919115911;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-WebApplication5-20160919115911.mdf" /&gt; )
</code></pre>

<p>Please guide me what to do.</p>

<p>I had made the database on <code>localhost</code>.</p>