title: New rows not storing in the database
body: <p>I'm using the following code to store data from form inputs into a database.</p>
  
  <p>The code seems to execute successfully and the message box states that one row has been affected (as expected).</p>
  
  <p>When I look at the data sources window within visual studio there are no new rows saved within the data set.</p>
  
  <p>Where are the new rows being saved to? How do I commit them to the database?</p>
  
  <p>Thanks in advance.</p>
  
  <pre><code>    private void btnSavePublication_Click(object sender, EventArgs e)
      {
          // get the inputs
          int pubID = Convert.ToInt32(txtPubID.Text);
          string pubTitle = txtTitle.Text;
          long pubBarcode = Convert.ToInt64(txtBarcode.Text);
          string pubDate = txtRecievedDate.Text;
          decimal pubPrice = Convert.ToDecimal(txtPrice.Text);
  
          // retrieve the connection string
          string myConnectionString = Properties.Settings.Default.Database1ConnectionString;
  
          // open the connection to the database
          SqlConnection connection = new SqlConnection();
          connection.ConnectionString = myConnectionString;
  
          // create a SQL command to update the table
          SqlCommand command = new SqlCommand();
          command.Connection = connection;
  
          // set up the paramaters
          command.Parameters.AddWithValue("@PublicationID", pubID);
          command.Parameters.AddWithValue("@PublicationTitle", pubTitle);
          command.Parameters.AddWithValue("@PublicationBarcode", pubBarcode);
          command.Parameters.AddWithValue("@PublicationDate", pubDate);// TODO parse the date
          command.Parameters.AddWithValue("@PublicationPrice",pubPrice);
  
          // create the SQL query
          command.CommandText = "INSERT INTO Publication (PublicationID, PublicationTitle, " + 
                                                          "PublicationBarcode, PublicationDate, "+ 
                                                          "PublicationPrice)" +
                                "VALUES ( @PublicationID, @PublicationTitle, @PublicationBarcode, " + 
                                "@PublicationDate, @PublicationPrice)";
  
          // run the query (hopefully)
          try {
              connection.Open();
              int rowsAffected = command.ExecuteNonQuery();
              MessageBox.Show( rowsAffected + " rows affected");
  
          }
          catch {
              MessageBox.Show("Wakka wakka");
          }
          finally {
              connection.Close();
          }
      }
  </code></pre>
  
  <p>edit : This is my connection string -</p>
  
  <pre><code>"Data Source=(LocalDB)\\v11.0;AttachDbFilename=|DataDirectory|\\Database1.mdf;Integr" +
          "ated Security=True;Connect Timeout=30"
  </code></pre>