How to avoid "Duplicate name in TFieldDefs" in virtualtable

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
tcflam
Posts: 58
Joined: Tue 01 Jan 2013 10:48

How to avoid "Duplicate name in TFieldDefs" in virtualtable

Post by tcflam » Sun 22 Feb 2015 13:51

Hi all,

How can avoid "Duplicate name in TFieldDefs" in virtualtable? The following is my code:

VirtualTable1.ClearFields;
VirtualTable1.FieldDefs.Clear;

Thanks!

azyk
Devart Team
Posts: 1057
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: How to avoid "Duplicate name in TFieldDefs" in virtualtable

Post by azyk » Mon 23 Feb 2015 15:48

We couldn't reproduce the problem. Please try reproduce the problem on our SdacDemo project - and let us know the results. The SDACDemo project is in the "Demos\SDACDemo\" folder relatively to the SDAC projects installation path.

tcflam
Posts: 58
Joined: Tue 01 Jan 2013 10:48

Re: How to avoid "Duplicate name in TFieldDefs" in virtualtable

Post by tcflam » Tue 24 Feb 2015 08:58

I'm using dynamic create field. Can I check the field is exist before create the field?

Thanks!

azyk
Devart Team
Posts: 1057
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: How to avoid "Duplicate name in TFieldDefs" in virtualtable

Post by azyk » Tue 24 Feb 2015 11:15

You can check whether a field with such name exists, for example, using the TVirtualTable.FieldDefs.IndexOf method. See more details about this method in the Embarcadero documentation: http://docwiki.embarcadero.com/Librarie ... on.IndexOf .

Post Reply