How to get the mysql table id for a combobox

0

My question is I have a combobox in the application and this combobox is populated with data coming from the mysql database so far so good. I throw the data in a DataSource to feed the combobox however when the user chooses a result of the combobox such as: Sector = FINANCIAL I want to record in the bank the financial sector ID and not the financial word. How can I get this Id?

ParamByName('SETOR').AsString := SETOR.????????; == > This is where my combobox is called the sector.

    
asked by anonymous 14.09.2017 / 17:06

1 answer

1

What you want is the behavior of TDBLookupComboBox . This allows you to bind to a datasource and define the field that the user sees (ListField) and the one that you are going to use (KeyField).

But in your case maybe you did not need a TDBLookupComboBox but a TLookupComboBox, which as much as I know only with external components (I personally use DevExpress ones)

    
15.09.2017 / 00:46