I have created a firemonkey app for windows with many components-editbox, label, rectangles, layout and a database in sqllite. I want to transfer combobox data to database table but failed. Anyone help how to transfer data from combobox to sqllite database.
I have tried these -
FDQue.FieldByName('CustomerName').AsString :=cbCN.Items.Text;
FDQue.FieldByName('CustomerName').AsString :=cbCN.Selected.Text;
Both syntax are not success. First syntax store only first item of combobox into database. Second gives "Access Violation error"
You need to use the following code example:
FDQue.FieldByName('CustomerName').AsString := cbCN.Items[cbCN.ItemIndex];
It will store the selected ComboBox item into the field CustomerName
.
Also don't forget to call FDQue.Post
after you have set all necessary field values to finally save them to the database!