title: Update Record Code Error
body: <p>I get an error:</p>
  
  <blockquote>
    <p>An unhandled exception of type 'System.InvalidCastException' occurred in System.Data.dll</p>
    
    <p>Additional information: Failed to convert parameter value from a ComboBox to a String.</p>
  </blockquote>
  
  <p>What am I missing?</p>
  
  <pre><code>Private Sub cmdUpdate_Click(sender As Object, e As EventArgs) Handles cmdUpdate.Click
  
      If txtBursaryR_ID.Text = "" Then
          MessageBox.Show("Empty Id")
      Else
          Dim DBcon As SqlConnection
  
          DBcon = New SqlConnection("Server=.\FGG;Database=CAOOSC_DB;User=sa;Pwd=c0nstella;")
  
          Dim command As New SqlCommand("UPDATE tbl_Beneficiaries Set BursaryR_ID=@BursaryR_ID,Donor_ID=@Donor_ID,DonorName=@DonorName,Province=@Province,District=@District,First_Name=@First_Name,Last_Name=@Last_Name,Sex=@Sex,Name_of_School=@Name_of_School,School_Address=@School_Address,Grade_Enrolled=@Grade_Enrolled,Prev_School=@Prev_School,Prev_District=@Prev_District,Intake_Year=@Intake_Year,Child_Vulnerability=@Child_Vulnerability,Children_Disabled=@Children_Disabled,Bursary_Provided=@Bursary_Provided,Supplies=@Supplies,GFirst_Name=@GFirst_Name,GLast_Name=@GLast_Name,Contact_Number=@Contact_Number, ", DBcon)
  
          command.Parameters.Add("@Donor_ID", SqlDbType.NChar).Value = txtDonor_ID
          command.Parameters.Add("@DonorName", SqlDbType.VarChar).Value = cbDonorName.SelectedItem
          command.Parameters.Add("@Province", SqlDbType.VarChar).Value = cbProvince.SelectedItem
          command.Parameters.Add("@District", SqlDbType.VarChar).Value = cbDistrict.SelectedItem
          command.Parameters.Add("@First_Name", SqlDbType.VarChar).Value = txtFirst_Name
          command.Parameters.Add("@Last_Name", SqlDbType.VarChar).Value = txtLast_Name
          command.Parameters.Add("@Sex", SqlDbType.NChar).Value = cbSex.SelectedItem
          command.Parameters.Add("@Name_of_School", SqlDbType.VarChar).Value = txtName_of_School
          command.Parameters.Add("@School_Address", SqlDbType.VarChar).Value = txtAddress
          command.Parameters.Add("@Grade_Enrolled", SqlDbType.NChar).Value = txtGrade_Enrolled
          command.Parameters.Add("@Prev_School", SqlDbType.VarChar).Value = txtPre_School
          command.Parameters.Add("@Prev_District", SqlDbType.VarChar).Value = txtPrev_District.SelectedItem
          command.Parameters.Add("@Intake_Year", SqlDbType.NChar).Value = cbIntake_Year.SelectedItem
          command.Parameters.Add("@Child_Vulnerability", SqlDbType.VarChar).Value = cbChild_Vulnerability.SelectedItem
          command.Parameters.Add("@Children_Disabled", SqlDbType.VarChar).Value = cbChildren_Disabled.SelectedItem
          command.Parameters.Add("@Bursary_Provided", SqlDbType.NChar).Value = cbBursary_Provided.SelectedItem
          command.Parameters.Add("@Supplies", SqlDbType.VarChar).Value = txtSupplies
          command.Parameters.Add("@GFirst_Name", SqlDbType.VarChar).Value = txtGFirst_Name
          command.Parameters.Add("@GLast_Name", SqlDbType.VarChar).Value = txtGLast_Name
          command.Parameters.Add("@Contact_Number", SqlDbType.NChar).Value = txtGContact
  
          DBcon.Open()
  
          If command.ExecuteNonQuery() = 1 Then
              MessageBox.Show("Data Updated")
          Else
              MessageBox.Show("Data Not Updated")
          End If
  
          DBcon.Close()
      End If
  End Sub
  </code></pre>