Problem editing datasets after upgrading to sdac 4

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
tonisanta
Posts: 55
Joined: Wed 04 Apr 2007 17:25

Problem editing datasets after upgrading to sdac 4

Post by tonisanta » Thu 05 Apr 2007 08:12

Hi,
after upgrading from sdac3 to 4 I've problems editing TMsQuery-datasets. A query like Select tbl1.*, tbl2.name from tbl1 left outer join tbl2 on tbl1.id_tbl2 = tbl2.id order by tbl1.name reports a 'ambiguous field'-msg when setting the dataset in editmode. Looking the Sql in profiler an 'where id=&P1' is added. (id is the primary key). RefreshSQL and UpdateTable are both nil. Only setting the RefreshSQL the problem could be resolved. With sdac3 this problem wasn't there. Now I'll have to set the RefreshSQL for all queries containing joins with same names for primary keys (in all my tables the primary key is named ID). Could you resolve this adding the first tablename in the runtime-addes RefreshSQL if no updatetable is specified, otherwise the name of the UpdateTable?
best regards
Toni

Jackson
Posts: 512
Joined: Thu 26 Jan 2006 10:06

Post by Jackson » Thu 05 Apr 2007 13:26

Please specify the script for creating tables in database.

tonisanta
Posts: 55
Joined: Wed 04 Apr 2007 17:25

Post by tonisanta » Thu 05 Apr 2007 14:11

Hi,
create a TMsQuery and a connection to Northwind; put this sql into the query:
select customers.*,
orders.orderDate as ord_date,
employees.lastname as emp_name
from
customers left outer join orders on customers.customerid = orders.customerid
left outer join employees on orders.employeeid = employees.employeeid
order by customers.companyname
set TMsQuery.Options.FullRefresh=true;
connect a datasource to the query, a dbgrid to the datasource, launch it and try to edit one of the records.
Please, let me know if you are not able to reproduce the problem. Seems it depends on the FullRefresh-option.
Toni

Jackson
Posts: 512
Joined: Thu 26 Jan 2006 10:06

Post by Jackson » Fri 06 Apr 2007 09:11

Thank you for information.
We have reproduced the problem and fixed it.
This fix will be included in the next build of SDAC 4.
Please watch for announcements at the forum.

Post Reply