title: How to dynamically change the name of column in the sqlstatement to be used for retrieving data using a combobox
body: <p>I want to dynamically change the name of the column in my sqlstatement every time I select an item name similar of the columns on the cmbcategory comboBox. Then use it to get its data to be transferred to the cmbparts comboBox. Is it possible? </p>
  
  <p>This is my sample code:</p>
  
  <pre><code>    Public Sub cmbpartfill()
  
          sqlstatement = "select '" &amp; cmbcategory.Text &amp; "' from tblparts"
          Connect()
          command = New MySqlCommand(sqlstatement, connection)
          reader = command.ExecuteReader
          While reader.Read
              cmbpart.Items.Clear()
              cmbpart.Items.Add(reader.Item(0).ToString)
          End While
          Disconnect() 
  
      End Sub
  </code></pre>
  
  <p>I would appreciate any help. Thanks.</p>