title: Windows form application database: "An unhandled exception of type 'System.ArgumentException' occurred in System.Data.dll"
body: <p>I'm really a newbie at programming so do excuse me if my knowledge seems really inadequate. I'm doing a C# project for my school and I'm having problems starting my database up.</p>
  
  <p>Here are some codes:</p>
  
  <pre><code>private void buttonPurchase_Click(object sender, EventArgs e)
  {
      if (MessageBox.Show("Purchase?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) 
      {
          // store invoice
          System.Data.SqlClient.SqlConnection sqlConnection1 =
               new System.Data.SqlClient.SqlConnection("CarDBConnectionString");
          System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand();
          cmd.CommandType = System.Data.CommandType.Text;
          cmd.CommandText = "INSERT into invoiceTbl(invoiceId, date, time) values (1, 21/6/2014, 11:13PM)";
  
          sqlConnection1.Open();
          cmd.ExecuteNonQuery();
          sqlConnection1.Close();
       }
  }
  </code></pre>
  
  <p>With these codes, I kept facing the error </p>
  
  <blockquote>
    <p>Format of the initialization string does not conform to to specification starting at index 0 1", under "An unhandled exception of type 'System.ArgumentException' occurred in System.Data.dll"</p>
  </blockquote>
  
  <p>Also here are the codes from my app.config</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;configuration&gt;
      &lt;configSections&gt;
      &lt;/configSections&gt;
      &lt;startup&gt; 
          &lt;supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /&gt;
      &lt;/startup&gt;
  
    &lt;connectionStrings&gt;
      &lt;add name="CarDBConnectionString" connectionString="Data Source=(LocalDB)\v11.0;InitialCatalogue=CarDB;AttachDbFilename=|DataDirectory|\CarDB.mdf;Integrated Security=True"
        providerName="System.Data.SqlClient" /&gt;
      &lt;add name="Draft_1.Properties.Settings.CarDBConnectionString"
        connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\CarDB.mdf;Integrated Security=True"
        providerName="System.Data.SqlClient" /&gt;
    &lt;/connectionStrings&gt;
  
  &lt;/configuration&gt;
  </code></pre>
  
  <p>I have tried googling everywhere but I can't seem to understand any of the solutions :-( Any help will be very much appreciated, thank you!</p>