Page 1 of 1

HowTo update *renamed* fields?

Posted: Sun 15 Feb 2009 15:25
by Minotaurus007
TMyQuery renames fields if they are identical in two tables:
T1.ID, T2.ID => QueryFields: ID, ID_1;
Setting

Code: Select all

Query->UpdatingTable = "T2";
doesn't really help because subsequent update operations raise an exception: "Field ID_1 cannot be found in T2".

Workaround, if all fields from both tables (SELECT *) are required? :?:

Posted: Thu 19 Feb 2009 11:53
by Dimon
In order to solve the problem you can rewrite a SQL query using the AS statement, like this:

Code: Select all

SELECT T1.ID AS ID1, T2.ID AS ID ...
Also you can use SQLUpdate property to specify the SQL statement that will be used when applying an update to a dataset. You can find more detailed information about this property in the MyDAC help.