Note that there are some explanatory texts on larger screens.

plurals
  1. USCary Jensen
    primarykey
    data
    text
    plurals
    1. This table or related slice is empty.
    1. COYour solution is a good one, in that you can still reliably refer to specific TFields by their known physical location in the structure of the underlying DataSet. The limitation is, as you've pointed out, this works for ADO DataSet only. However, you sent me back on second search for a corresponding member of the TFields class. This class has a FieldByNumber method, which is invariant with respect to the order of Columns in an associated grid. FieldByNumber is like your Item property. I've added an answer to the question that explains FieldByNumber in more detail than is availale here.
      singulars
    2. COI don't think that this is a bug. It may be unexpected, simply because it is a little known artifact, but it doesn't look like a bug.
      singulars
    3. COThere is a question, which appears in the second sentence: "Is it something internal to the TDataSet class, an artifact of the TDBGrid, or something else?" I spend some time (an hour or so) searching both the TCustomGrid and TDataSet source, but didn't see where this is happening. More importantly, and this is why my post is so long, I wanted to at least make Delphi developers aware of this interesting behavior. For anyone who is using a DBGrid, or some other similar grid that produces these changes in the TFields order, it could be a source of an intermittent, and difficult to find bug.
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload