1
votes

First of all, I'm pretty new to Delphi.

I have a DBGrid connected to a DataSource and filled up with data from an SQL server. What I want to achieve is that when I press a button, it brings up a new window with comboboxes/editboxes, all filled up with the previously selected (in DBGrid) row's data and modify them and execute an UPDATE query.

In order to do that, I need the primary key value of the selected record, so my little program would know which row should it display and update.

My question is, how can I get a specific cell value (in this case, an id) of a selected record from a DBGrid?

1
You can link extra DBEdits, DBComboBoxes and so on to the data source of your DBGrid. These will then be filled with the data of the selected row automatically!Delphi Coder

1 Answers

1
votes

If you know the column for the ID field you can inspect its Field property. The Fields Value will contain the current ID.