Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/Database/TField/TStringField    [ Add a report in this area ]  
Report #:  134631   Status: Open
XE10: TFields never updates its dictionary
Project:  Delphi Build #:  23.0.20618.2753
Version:    21.0 Submitted By:   Robert Cerny
Report Type:  Basic functionality failure Date Reported:  11/2/2015 6:40:45 AM
Severity:    Commonly encountered problem Last Updated: 12/14/2015 6:22:32 AM
Platform:    All platforms Internal Tracking #:   72853
Resolution: None (Resolution Comments) Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
TFields class has a Tdictionary class to speed up FindField and FieldByName methods. Great. The dictionary object adds fields, but never updates its contents, when the fieldname changes.

See steps.
Steps to Reproduce:
1. Drop a dataset component (For example TQuery) on a form.
2. set properties needed to create designtime fields (databasename, SQL='select id,name from dbo.customer',...)
3. create Tfield components with fields editor
4. Formcreate event handler:
procedure Txx.Formcreate(...)
  Query1.SQL.Text := 'select id as Customer_id,name from dbo.customer';
  Query1.Fields[0].FieldName := 'Customer_id';
  ShowMessage(Query1.Fields[0].FieldName);// Customer_id
  if Query1.FindField('Customer_id')=nil
    ShowMessage('Customer_id not found')
5. Run.


Server Response from: ETNACODE01