DBGrid : How to access to the data fields ?

From: tuxim (no_spam_at_no_spam.org)
Date: 06/23/04


Date: Wed, 23 Jun 2004 15:49:13 +0200

I use the following instruction to get the record counts in my DBGrid ...

count := DBGrid1.DataSource.DatasSet.RecordCount;

When executing my program (just one ecample) the count value is 13861.

Here my Question:

I have an DBGrid component on my Form to display some part of my database.
How can I access the Fields in each row ? For instance I can only read the
data from the first row!

I used following code to access the data in the first row :

Dos_ID := DBGrid.DataSource.DataSet.Fields[0].AsInteger // First column
Dos_ID := DBGrid.DataSource.DataSet.Fields[3].AsInteger // Fourth column

How can I access the data in the other rows?