title: How To Get SqlConnection Instantiated?
body: <p>I am following a tutorial to make an ASP.NET web app and came to the part of establishing a connection to my SQL database item I added withing VisualStudio via Add>New Item command when right-clicking on my project name in Solution Explorer.</p>
  
  <p>However, after putting the appropriate namespaces, VS is not recognizing the SQLConnection I'm trying to instantiate.</p>
  
  <p>I keep getting the error: "the modifier 'new' is not valid for this item" among others.</p>
  
  <p>I already tried removing the "@" symbol, already tried putting the path in a string, but now VS is not even recognizing a simple string instantiation!</p>
  
  <p>Here is code version 1:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using System.Web.UI;
  using System.Web.UI.WebControls;
  using System.Data;
  using System.Data.SqlClient;
  
  namespace AdressBook
  {
      public partial class WebForm1 : System.Web.UI.Page
  
          SqlConnection conn = new SqlConnection("Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename|DataDirectory\AdressBookDatabase.mdf;Integrated Security=True");
  </code></pre>
  
  <p>Here is code version 2:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using System.Web.UI;
  using System.Web.UI.WebControls;
  using System.Data;
  using System.Data.SqlClient;
  
  namespace AdressBook
  {
      public partial class WebForm1 : System.Web.UI.Page
  
          string datapath = "Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename|DataDirectory\AdressBookDatabase.mdf;Integrated Security=True"
  
          SqlConnection conn = new SqlConnection(datapath);
  </code></pre>
  
  <p>I expect there to be no red/green underlines and be able to connect to my database when a button is clicked. What is wrong?</p>