title: How to add data into Specified columns in mysql using c#
body: <p>How to add data into Specified columns in mysql database table using c# button click, once i clicked the button it will be passing to the catch</p>
  
  <p>here is my add button code</p>
  
  <pre><code> private void Button_add_Click(object sender, RoutedEventArgs e)
      {
          try
          {
              string Query = @"INSERT INTO `bcasdb`.`tbl_department`(
                  `dep_id`,
                  `dep_name`,
                  `tbl_branch_branch_id`) 
          VALUES (" 
                 + this.depIDInput.Text + ",'" 
                 + this.depnameInput.Text + "','" 
                 + this.dep_branchIDInput.Text + "')";
              //This is command class which will handle the query and connection object.
              MySqlConnection conn = new MySqlConnection(BCASApp.DataModel.DB_CON.connection);
              MySqlCommand cmd = new MySqlCommand(Query, conn);
              MySqlDataReader MyReader;
              conn.Open();
              MyReader = cmd.ExecuteReader();// Here our query will be executed and data saved into the database.           
              conn.Close();
              successmsgBox();
          }
          catch (Exception)
          {
              errormsgBox();
          }
      }
  </code></pre>
  
  <p>here is all the columns of the table,</p>
  
  <pre><code>INSERT INTO `bcasdb`.`tbl_student`
  (`reg_id`,
  `std_fname`,
  `std_lname`,
  `tbl_batch_batch_id`,
  `gender`,
  `dob`,
  `email`,
  `mobile`,
  `contact_address`,
  `home_address`,
  `status`,
  `course_id`,
  `depart_id`,
  `parent_name`,
  `telephone`,
  `nationality`,
  `nic`,
  `passport_no`,
  `acadamic_qulification`,
  `current_employement`,
  `gce_ol`,
  `gce_al`,
  `birth_certifiacte`,
  `copy_of_nic`,
  `police_clerence`,
  `tbl_studentcol`)
  VALUES
  </code></pre>