title: The connection string for a local SQL 2012 Express Server Instance
body: <p>So I've been wanting to learn a little more about SQL but I'm having some trouble connecting to a local SQL server database in the ASP.NET project I'm working on. Though I'm able to connect using Visual Studio and SQL Server Management Studio, I just can't get the connection string right. I've been looking at connectionstrings.com but I get exceptions when using alot of the keywords it suggests (server, initial catalog, database, etc.).</p>
  
  <p>*Edit - Added Web.config</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  
  &lt;configuration&gt;
    &lt;system.web&gt;
      &lt;compilation debug="true" targetFramework="4.5" /&gt;
      &lt;httpRuntime targetFramework="4.5" /&gt;
    &lt;/system.web&gt;
  
    &lt;connectionStrings&gt;
      &lt;add name="StarterSite" connectionString="Data Source=|DataDirectory|\StarterSite.sdf" providerName="System.Data.SqlServerCe.4.0" /&gt;
      &lt;add name="AdventureWorks" connectionString="Data Source=ROBERT-PC;Initial Catalog=AdventureWorks2012;Integrated Security=True" /&gt;
      &lt;add name="DefaultConnnection" connectionString="Data Source=ROBERT-PC\MSSQLSERVER;Initial Catalog=AdventureWorks2012;Persist Security Info=True;User ID=USERNAME;Password=PASSWORD"
    providerName="System.Data.SqlClient" /&gt;
      &lt;/connectionStrings&gt;
  
    &lt;runtime&gt;
      &lt;assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="DotNetOpenAuth.Core" publicKeyToken="2780ccd10d57b246" /&gt;
          &lt;bindingRedirect oldVersion="1.0.0.0-4.1.0.0" newVersion="4.1.0.0" /&gt;
        &lt;/dependentAssembly&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="DotNetOpenAuth.AspNet" publicKeyToken="2780ccd10d57b246" /&gt;
          &lt;bindingRedirect oldVersion="1.0.0.0-4.1.0.0" newVersion="4.1.0.0" /&gt;
        &lt;/dependentAssembly&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" /&gt;
          &lt;bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" /&gt;
        &lt;/dependentAssembly&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" /&gt;
          &lt;bindingRedirect oldVersion="1.0.0.0-1.5.2.14234.0.0" newVersion="1.5.2.14234.0.0" /&gt;
        &lt;/dependentAssembly&gt;
      &lt;/assemblyBinding&gt;
    &lt;/runtime&gt;
  &lt;system.data&gt;        
          &lt;DbProviderFactories&gt;
              &lt;remove invariant="System.Data.SqlServerCe.4.0" /&gt;
              &lt;add name="Microsoft SQL Server Compact Data Provider 4.0" invariant="System.Data.SqlServerCe.4.0" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" /&gt;
          &lt;/DbProviderFactories&gt;
      &lt;/system.data&gt;&lt;/configuration&gt;
  </code></pre>