title: Compiler Error Message: CS1519: Invalid token '=' in class, struct, or interface member declaration
body: <p>I keep encountering the following compilation error:</p>
  
  <pre><code>            Compilation Error
  
              Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. 
  
              Compiler Error Message: CS1519: Invalid token '=' in class, struct, or interface member declaration
  
              Source Error:
  
  
                Line 22:              
                Line 23:  //Assign a Connection String
                Line 24:  conn.ConnectionString = ConfigurationManager.ConnectionStrings["sauceatronConnString"].ConnectionString;
                Line 25:          
                Line 26:  //Connection Open   
  
                Source Line: 24 
  </code></pre>
  
  <p>Just want to preface this with new to programming in general and in ASP and C#. I've used the same code to connect to the database before and it worked fine but now I'm getting that error which I'm not too familiar with on how to resolve. Below is the code for my aspx page and my web.config.</p>
  
  <pre><code>            &lt;%@Page Language="C#" MasterPageFile="MasterPage/AtronsSiteMaster.master"%&gt;
              &lt;%@ Import Namespace="System.Data"%&gt;
              &lt;%@ Import Namespace="System.Data.Common"%&gt;
              &lt;%@ Import Namespace="System.Data.OleDb"%&gt;
               &lt;%@ Import Namespace="System.Configuration"%&gt;
              &lt;%@ Import Namespace="System.Collections.Generic"%&gt;
  
              &lt;asp:Content ContentPlaceHolderID="titleContentPlaceHolder" ID="titleContent" runat="server"&gt;Products&lt;/asp:Content&gt;
  
             &lt;asp:Content ContentPlaceHolderID="headContentPlaceHolder" ID="headContent" runat="server"&gt;&lt;/asp:Content&gt;
  
               &lt;script runat="server" language="C#"&gt;
  
                      String provider = ConfigurationManager.ConnectionStrings["sauceatronConnString"].ProviderName;
  
                      DbProviderFactory factory = DbProviderFactories.GetFactory(provider);
  
                      //Open a Connection
                      DbConnection conn = factory.CreateConnection();
  
                      //Assign a Connection String
                      conn.ConnectionString = ConfigurationManager.ConnectionStrings["sauceatronConnString"].ConnectionString;
  
                      //Connection Open
                      conn.Open();
  
                      //Initialize a Command
                      DbCommand comm = conn.CreateCommand();
  
                      //Tell the command which connection it will use
                      comm.Connection = conn;
  
                      //Give the command SQL to execute
                      comm.CommandText = "Select ProductName,ProductIssue,Writer,UnitPrice from Products order by ProductName, ProductIssue";
  
                      //Execute the command and get back the results via a reader
                      DbDataReader reader = comm.ExecuteReader();
  
                      //While we get results from the DB, add a row to the Table
                      while (reader.Read())
                      {
                          TableRow row = new TableRow();
                          TableCell cell;
  
                          cell = new TableCell();
                          cell.Text = reader["ProductName"].ToString();
                          row.Cells.Add(cell);
  
                          cell = new TableCell();
                          cell.Text = reader["ProductIssue"].ToString();
                          row.Cells.Add(cell);
  
                          cell = new TableCell();
                          cell.Text = reader["Writer"].ToString();
                          row.Cells.Add(cell);
  
                          cell = new TableCell();
                          cell.Text = reader["UnitPrice"].ToString();
                          row.Cells.Add(cell);
                      }
  
                      //Free up the connection
                      conn.Close();
  
                  &lt;/script&gt;
  
                  &lt;asp:Content ContentPlaceHolderID="pageTitleContentPlaceHolder" ID="pageTitleContent" runat="server"&gt;Products&lt;/asp:Content&gt;
  
                  &lt;asp:Content ContentPlaceHolderID="mainContentPlaceHolder" ID="mainContent" runat="server"&gt;
                      &lt;asp:Table ID="tblData" runat="server"&gt;
                          &lt;asp:TableHeaderRow&gt;
                              &lt;asp:TableHeaderCell&gt;Comic Book Name&lt;/asp:TableHeaderCell&gt;
                              &lt;asp:TableHeaderCell&gt;Issue&lt;/asp:TableHeaderCell&gt;
                              &lt;asp:TableHeaderCell&gt;Writer Name&lt;/asp:TableHeaderCell&gt;
                              &lt;asp:TableHeaderCell&gt;Price&lt;/asp:TableHeaderCell&gt;
                          &lt;/asp:TableHeaderRow&gt;
                      &lt;/asp:Table&gt;
               &lt;/asp:Content&gt; 
  
              &lt;configuration&gt;
                     &lt;system.web&gt;
                       &lt;customErrors mode="Off"/&gt;
                      &lt;compilation debug="true"/&gt;
                   &lt;/system.web&gt;
  
  
  
                     &lt;connectionStrings&gt;
                              &lt;add name="databaseConnString" connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=~\Database\database.accdb;Persist Security Info=False;" providerName="System.Data.OleDb"/&gt;
                              &lt;add name="studentConnString" connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=~\Database\students.mdb;Persist Security Info=False;" providerName="System.Data.OleDb"/&gt;
                              &lt;add name="sauceatronConnString" connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=~\finals\Database\SauceAtronsVault.accdb;Persist Security Info=False;" providerName="System.Data.OleDb"/&gt;
                     &lt;/connectionStrings&gt;
  
                &lt;/configuration&gt;
  </code></pre>