title: Saving data to database from new form
body: <p>I have a program that uses a dataGridView on Form1 to display data from a SQL Server database. </p>
  
  <p>The user can also edit and save data back to the DB from the Form1 dataGridView. </p>
  
  <p>However, I also have a search function that will pop up a new form and display the results of the search.</p>
  
  <p>I want users to be able to save directly from the new window but at the moment it is only updating the data in the Form1 dataGridView. </p>
  
  <p>This is what I am using to display the results of the Search. </p>
  
  <pre><code>private void ResultsFunc()
      {
          var ColumnToSearch = comboBox1.Text;
  
          if (textBox1.Text.Length == 0)
          {
              var toSearchBy = listBox1.SelectedItem.ToString();
              aSH_ORDER_DBDataSet1.ASH_PROD_ORDERS.DefaultView.RowFilter = ColumnToSearch + " = " + "'" + toSearchBy + "'";
          }
          else if (textBox1.Text.Length &gt; 0)
          {
              var toSearchBy = textBox1.Text;
              aSH_ORDER_DBDataSet1.ASH_PROD_ORDERS.DefaultView.RowFilter = ColumnToSearch + " = " + "'" + toSearchBy + "'";
          }
  
          Form2 resultsForm = new Form2();
          resultsForm.dataGridView2.DataSource = aSH_ORDER_DBDataSet1.ASH_PROD_ORDERS.DefaultView;
          resultsForm.Show();
      }
  </code></pre>
  
  <p>This is what I am using to try save the data from Form2: </p>
  
  <pre><code>private void button1_Click(object sender, EventArgs e)
      {
          aSH_PROD_ORDERSTableAdapter.Update(aSH_ORDER_DBDataSet1);
      }
  </code></pre>
  
  <p>How can I get the info entered in Form2 to save directly to the database rather than just update the dataGridView in Form1? </p>