How to autofill a radio_button, a few combo_boxes, many text_boxes, and a calendar FROM a combo_box selection
<p>I am creating a tool that will allow a Human Resource employee to input various information about a new employee into an access database(for academic purposes). So far I have the layout set-up (as you will be able to see shortly), validation is in a place, and a dataGridView gets populated by using an Access Database I created. Then I have 3 buttons, Submit (Insert), Update and Delete. </p>

<p>PS: I know that the table I am trying to update is huge, but that's what our team decided to do.</p>

<p>Image of my layout:</p>

<p><a href="http://postimage.org/image/m5ba7b5vj/full/" rel="nofollow">Human Resource employee tool</a></p>

<p>The submit and delete works, BUT the update only works if all of the fields are filled with data. The code I wrote tries to update all the fields WHERE the EMPLOYEE_ID equals the value that's selected on the combo_box, so if I try to update only one field I get an error saying "No value given for one or more required parameters". I think that by auto-filling all the field on the left when a value from a combo_box is selected will fix my problem. The thing is that I have no idea on how to accomplish this. Any help would be appreciate it!!</p>

<p>UPDATE STATEMENT.</p>

<pre><code>private void cmdModify_Click(object sender, EventArgs e)
        {
            //Setting up Connection String
            string connectionString = GetConnectionString();

            string SqlString = "UPDATE Employee SET FIRST_NAME = @FirstName , LAST_NAME= @LastName, MIDDLE_NAME = @MiddleName, DATE_HIRED =@DateHired, WAGE_TYPE =@WageType, WAGE = @Wage, GENDER =@Gender, MARTIAL_STATUS =@MartialStatus, UNIT_NUMBER =@UnitNumber, STREET_NUMBER =@StreetNumber, STREET_NAME =@StreetName, CITY =@City, PROVINCE =@Province, POSTAL_CODE =@PostalCode, HOME_NUMBER =@HomeNumber, CELL_NUMBER =@CellNumber, JOB_TITTLE =@JobTittle, END_DATE=7/24/2013, DPT_NAME =@Department, NOTES =@Notes WHERE [EMPLOYEE_ID] = @EMPLOYEE_ID";

            using (OleDbConnection conn = new OleDbConnection(connectionString))
            {
                using (OleDbCommand cmd = new OleDbCommand(SqlString, conn))
                {
                    cmd.CommandType = CommandType.Text;
                    cmd.Parameters.AddWithValue("FirstName", txtFname.Text);
                    cmd.Parameters.AddWithValue("LastName", txtLname.Text);
                    cmd.Parameters.AddWithValue("MiddleName", txtMname.Text);
                    cmd.Parameters.AddWithValue("DateHired", dateTimePicker1.Text);
                    cmd.Parameters.AddWithValue("WageType", cmbType.SelectedItem);
                    cmd.Parameters.AddWithValue("Wage", txtWage.Text);
                    if (rbMale.Checked == true)
                    {
                        cmd.Parameters.AddWithValue("Gender", rbMale.Text);
                    }
                    else if (rbFemale.Checked == true)
                    {
                        cmd.Parameters.AddWithValue("Gender", rbFemale.Text);
                    }
                    cmd.Parameters.AddWithValue("MartialStatus", cmbStatus.SelectedItem);
                    cmd.Parameters.AddWithValue("UnitNumber", txtUnit.Text);
                    cmd.Parameters.AddWithValue("StreetNumber", txtStreetNo.Text);
                    cmd.Parameters.AddWithValue("StreetName", txtStreet.Text);
                    cmd.Parameters.AddWithValue("City", txtCity.Text);
                    cmd.Parameters.AddWithValue("Province", cmbState.SelectedItem);
                    cmd.Parameters.AddWithValue("PostalCode", txtPostal.Text);
                    cmd.Parameters.AddWithValue("HomeNumber", txtHphone.Text);
                    cmd.Parameters.AddWithValue("CellNumber", txtCphone.Text);
                    cmd.Parameters.AddWithValue("JobTittle", cmbJobTitle.SelectedItem);
                    cmd.Parameters.AddWithValue("Department", cmbDepartment.SelectedItem);
                    cmd.Parameters.AddWithValue("Notes", txtNotes.Text);
                    cmd.Parameters.AddWithValue("EMPLOYEE_ID", comboBox1.SelectedValue);

                    try
                    {
                        // openning a connection to the database / table
                        conn.Open();
                        // SQL commnd class
                        cmd.ExecuteNonQuery();
                        //Closing Database connection
                        conn.Close();
                        //Console.WriteLine("Data was added to the table !!!");
                        MessageBox.Show("Data was added to the table !!!");
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                        //Console.WriteLine(ex.Message); // printing exception message to default output
                    }
                }
            }
            Refresh();
            clearText();
        }
</code></pre>

<p>INSERT STATEMENT.</p>

<pre><code>private void Insert_Data()
        {
            string connectionString = GetConnectionString();
            string SqlString = "INSERT INTO Employee (FIRST_NAME, LAST_NAME, MIDDLE_NAME, DATE_HIRED, WAGE_TYPE, WAGE, GENDER, MARTIAL_STATUS,UNIT_NUMBER, STREET_NUMBER, STREET_NAME, CITY ,PROVINCE, POSTAL_CODE, HOME_NUMBER, CELL_NUMBER, JOB_TITTLE, END_DATE, DPT_NAME, NOTES) VALUES (@FirstName,@LastName,@MiddleName,@DateHired,@WageType,@Wage,@Gender,@MartialStatus,@UnitNumber,@StreetNumber,@StreetName,@City,@Province,@PostalCode,@HomeNumber,@CellNumber,@JobTittle,7/24/2013,@Department,@Notes)";

            using (OleDbConnection conn = new OleDbConnection(connectionString))
            {
                using (OleDbCommand cmd = new OleDbCommand(SqlString, conn))
                {
                    cmd.CommandType = CommandType.Text;
                    cmd.Parameters.AddWithValue("FirstName", txtFname.Text);
                    cmd.Parameters.AddWithValue("LastName", txtLname.Text);
                    cmd.Parameters.AddWithValue("MiddleName", txtMname.Text);
                    cmd.Parameters.AddWithValue("DateHired", dateTimePicker1.Text);
                    cmd.Parameters.AddWithValue("WageType", cmbType.SelectedItem);
                    cmd.Parameters.AddWithValue("Wage", txtWage.Text);
                    if (rbMale.Checked == true)
                    {
                        cmd.Parameters.AddWithValue("Gender",rbMale.Text);
                    }
                    else if (rbFemale.Checked == true)
                    {
                        cmd.Parameters.AddWithValue("Gender", rbFemale.Text);
                    }
                    cmd.Parameters.AddWithValue("MartialStatus", cmbStatus.SelectedItem);
                    cmd.Parameters.AddWithValue("UnitNumber", txtUnit.Text);
                    cmd.Parameters.AddWithValue("StreetNumber", txtStreetNo.Text);
                    cmd.Parameters.AddWithValue("StreetName", txtStreet.Text);
                    cmd.Parameters.AddWithValue("City", txtCity.Text);
                    cmd.Parameters.AddWithValue("Province", cmbState.SelectedItem);
                    cmd.Parameters.AddWithValue("PostalCode", txtPostal.Text);
                    cmd.Parameters.AddWithValue("HomeNumber", txtHphone.Text);
                    cmd.Parameters.AddWithValue("CellNumber", txtCphone.Text);
                    cmd.Parameters.AddWithValue("JobTittle", cmbJobTitle.SelectedItem);
                    cmd.Parameters.AddWithValue("Department", cmbDepartment.SelectedItem);
                    cmd.Parameters.AddWithValue("Notes", txtNotes.Text);

                    try
                    {
                        // openning a connection to the database / table
                        conn.Open();
                        // SQL commnd class
                        cmd.ExecuteNonQuery();
                        //Closing Database connection
                        conn.Close();
                        //Console.WriteLine("Data was added to the table !!!");
                        MessageBox.Show("Data was added to the table !!!");
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                        //Console.WriteLine(ex.Message); // printing exception message to default output
                    }
                }
            }
            Refresh();
            clearText();
        }
</code></pre>

<p>DELETE STATEMENT</p>

<pre><code>private void cmdDelete_Click_1(object sender, EventArgs e)
        {
            //Setting up Connection String
            string connectionString = GetConnectionString();
            string SqlString = "DELETE * FROM Employee WHERE [EMPLOYEE_ID] = @EMPLOYEE_ID ";

            using (OleDbConnection conn = new OleDbConnection(connectionString))
            {
                using (OleDbCommand cmd = new OleDbCommand(SqlString, conn))
                {
                    cmd.CommandType = CommandType.Text;
                    cmd.Parameters.AddWithValue("EMPLOYEE_ID", comboBox1.SelectedValue);
                    try
                    {
                        // openning a connection to the database / table
                        conn.Open();
                        // SQL commnd class
                        cmd.ExecuteNonQuery();
                        //Closing Database connection
                        conn.Close();
                        //Console.WriteLine("Data was added to the table !!!");
                        MessageBox.Show("Data was deleted from the table !!!");
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                        //Console.WriteLine(ex.Message); // printing exception message to default output
                    }
                }
            }
            Refresh();
            clearText();
        }
</code></pre>
