Wrong Fieldnames with UniQuery

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Kirchi
Posts: 5
Joined: Tue 21 Aug 2012 15:16

Wrong Fieldnames with UniQuery

Post by Kirchi » Fri 23 May 2014 11:57

Hello,

I have a view in my Database. In this View, there are Fieldnames like

VP.Title
State.Title

When I do my SQL Query with Uniquery (Select * From myView) the fieldnames will be Title and Title_01 in the fieldlist of UniQuery. The Setting in Options.FieldsOrigin is True. I want to have the original fieldnames. How can i solve this Problem.

Thanks

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Wrong Fieldnames with UniQuery

Post by AlexP » Fri 23 May 2014 12:21

Hello,

Please specify the name of the DB you are using.

Kirchi
Posts: 5
Joined: Tue 21 Aug 2012 15:16

Re: Wrong Fieldnames with UniQuery

Post by Kirchi » Fri 23 May 2014 12:29

It is a MS Access Database.

I am Changing my Application from ADO to UniDAC. In Ado the fieldnames where the same like in the table.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Wrong Fieldnames with UniQuery

Post by AlexP » Fri 23 May 2014 13:36

We have checked this behavior in ADO. FieldName for identical fields is created with serial number as well. In UniDAC, to retrieve the real field name, you should set the FieldsOrigin option to True, In this case, the real field name can be retrieved with the Origin property:

Code: Select all

var
  i: integer;
begin
  UniQuery1.Open;
  for i:= 0 to UniQuery1.FieldCount - 1 do
    ShowMessage(UniQuery1.Fields[i].Origin);
end;

Kirchi
Posts: 5
Joined: Tue 21 Aug 2012 15:16

Re: Wrong Fieldnames with UniQuery

Post by Kirchi » Fri 23 May 2014 13:55

The field names are different in the original database (Sample: VP.Title and State.Title) and ADO has taken over these fieldnames. The fieldnames results from a view of multiple tables.

It gets complicated when this function no longer works to rewrite the project.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Wrong Fieldnames with UniQuery

Post by AlexP » Mon 26 May 2014 11:25

This is a specificity of Access and ADO (an ability to create views with identical fields). You can leave a suggestion to implement this feature at our uservoice page: http://devart.uservoice.com/forums/1046 ... components .

Post Reply