Q:

C# - Trying to get SQL Insert via Button on Form2 to update dataGridView on Form1

I'm brand new to the forum, and this is my first post.  I've already learned some things from reading other posts (different topics).  For this topic, I've found some that are close, but my experiments just don't pan out.  The Title of this post says it all - my dataGridView on Form1 populates OK, and my button on Form2 to insert a new database row works OK.  I need the dataGridView on Form1 to populate automatically after pressing the Insert button on Form2...without restarting the program.  I can restart and the new row is there.  I know I need to tie the two forms together...just not sure how.  I had some assistance with the Insert part, but that has complicated things a little for a beginner like me.  This is a small app that I just need to get working, so the simpler the better.  I will post a couple of fairly large chunks of code (hopefully, not too large).  Any help is appreciated!
//FORM 1 - PARTIAL CODE
private void Form1_Load(object sender, EventArgs e)
{
    // TODO: This line of code loads data into the 'DB_TEMPDataSet.Product' table. You can move, or remove it, as needed.
    Fillcombo();
    this.ProductTableAdapter.Fill(this.DB_TEMPDataSet.Product);
}

private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
    string strCmd = "Select * from Product where Mode='" + comboBox1.Text + "';";
    SqlConnection con = new SqlConnection(@"Data Source=myserver\dev1;Initial Catalog=DB_TEMP;Integrated Security=True");
    SqlCommand cmd = new SqlCommand(strCmd, con);
    try
    {
        con.Open();
        DataTable dt = new DataTable();
        SqlDataAdapter da = new SqlDataAdapter(cmd);
        da.Fill(dt);
        dataGridView1.DataSource = dt;
        con.Close();
     }
     catch (Exception ex)
     {
        MessageBox.Show(ex.Message);
     }
}

Form2 secondForm = new Form2();

private void button1_Click(object sender, EventArgs e)
{
    secondForm.ShowDialog();
}

And here is a nice chunk of Form 2:
//FORM 2 - PARTIAL CODE:

public partial class Form2 : Form
{
    public Form2()
    {
        InitializeComponent();

        Fillcombo2("BranchId", "Product", comboBox1);
        Fillcombo2("Mode", "Product", comboBox2);
        Fillcombo2("ChargeCode", "Product", comboBox3);
        Fillcombo2("ProductCode", "Product", comboBox4);
        Fillcombo2("CustomerType", "Product", comboBox5);
        Fillcombo2("CreatedBy", "Product", comboBox6);
        Fillcombo2("CreatedOn", "Product", comboBox7);
        Fillcombo2("LastUpdatedBy", "Product", comboBox8);
        Fillcombo2("LastUpdatedTime", "Product", comboBox9);
    }

    void Fillcombo2(string column, string table, ComboBox box)
    {
        string strCmd2 = "Select DISTINCT " + column + " from " + table + ";";
        SqlConnection con2 = new SqlConnection(@"Data Source=myserver\dev1;Initial Catalog=DB_TEMP;Integrated Security=True");
        SqlCommand cmd2 = new SqlCommand(strCmd2, con2);
        SqlDataReader myReader2;

        try
        {
            con2.Open();
            myReader2 = cmd2.ExecuteReader();

            while (myReader2.Read())
            {
                object sName2 = myReader2[column];
                box.Items.Add(sName2);
            }
            con2.Close();
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message);
        }
    }

    private void button1_Click(object sender, EventArgs e)
    {
        this.DialogResult = DialogResult.OK;

        string strCmd3 = @"
        INSERT INTO dbo.Product (BranchId, Mode, ChargeCode, ProductCode, CustomerType, CreatedBy, CreatedOn, LastUpdatedBy, LastUpdatedTime)
        VALUES(@BranchId, @Mode, @ChargeCode, @ProductCode, @CustomerType, @CreatedBy, @CreatedOn, @LastUpdatedBy, @LastUpdatedTime)
        ";

        using (SqlConnection con3 = new SqlConnection(@"Data Source=myserver\dev1;Initial Catalog=DB_TEMP;Integrated Security=True"))
        {
            try
            {
                con3.Open();
                using (SqlCommand cmd3 = con3.CreateCommand())
                {
                    cmd3.CommandText = strCmd3;
                    AddParameterWithValue(cmd3, "@BranchId", comboBox1.Text);
                    AddParameterWithValue(cmd3, "@Mode", comboBox2.Text);
                    AddParameterWithValue(cmd3, "@ChargeCode", comboBox3.Text);
                    AddParameterWithValue(cmd3, "@ProductCode", comboBox4.Text);
                    AddParameterWithValue(cmd3, "@CustomerType", comboBox5.Text);
                    AddParameterWithValue(cmd3, "@CreatedBy", comboBox6.Text);
                    AddParameterWithValue(cmd3, "@CreatedOn", comboBox7.Text);
                    AddParameterWithValue(cmd3, "@LastUpdatedBy", comboBox8.Text);
                    AddParameterWithValue(cmd3, "@LastUpdatedTime", comboBox9.Text);
                    cmd3.ExecuteNonQuery();
                }
                con3.Close();
                MessageBox.Show("Database row INSERT successful!");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
    }
}

A:

I will create a class to handle all Database related action, such that, it can hold the DataAdapter for insert/update/delete record
You may able to find the example from MSDN How to bind Data to DataGridView and How to update by using SqlDataAdapter.
Moreover, you may want to use SqlParameter for any sql command, it can protect your application for SQL injection attack, example here: SqlParameter

