title: EF code-first to create local database in ASP.NET MVC and C#
body: <p>I am new to ASP.NET MVC. While going through this tutorial <a href="https://docs.microsoft.com/en-us/aspnet/mvc/overview/getting-started/getting-started-with-ef-using-mvc/creating-an-entity-framework-data-model-for-an-asp-net-mvc-application" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/aspnet/mvc/overview/getting-started/getting-started-with-ef-using-mvc/creating-an-entity-framework-data-model-for-an-asp-net-mvc-application</a></p>
  
  <p>I am getting error </p>
  
  <blockquote>
    <p>CREATE FILE encountered operating system error 123 (the filename, directory name, or volume label syntax is incorrect.) while attempting to open or create the physical file 'C:\Users\AMIT &amp; AKASH\ContosoUniversity2 AttachDBFilename=|DataDirectory|_ContosoUniversity2.mdf.mdf'.<br>
    CREATE DATABASE failed. Some file names listed could not be created. Check related errors.</p>
  </blockquote>
  
  <p>My connection string </p>
  
  <pre><code>&lt;connectionStrings&gt;
      &lt;add name="SchoolContext" 
           connectionString="Data Source=(LocalDb)\v12.0;Initial Catalog=ContosoUniversity2 AttachDBFilename=|DataDirectory|\ContosoUniversity2.mdf;Integrated Security=SSPI;" 
           providerName="System.Data.SqlClient" /&gt;
  &lt;/connectionStrings&gt;
  </code></pre>
  
  <p><strong>SchoolInitializer.cs</strong></p>
  
  <p><a href="https://i.stack.imgur.com/pT2oK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pT2oK.png" alt="enter image description here"></a></p>
  
  <p><strong>StudentContext.cs</strong></p>
  
  <p><a href="https://i.stack.imgur.com/s293X.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/s293X.png" alt="enter image description here"></a></p>