Update keys in Views + RefreshRecord

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Frenk

Update keys in Views + RefreshRecord

Post by Frenk » Thu 22 Sep 2005 14:26

Hi,
after a testing of SDAC demo I also found out that when joining tables and views or nesting tables in a select statement, Key fields are not found.
i.e.:
Ident = Identity field

select a.Ident, a.desc from items a -- works OK

select a.Ident, a.Desc, B.ItemSUM from items A
left join V_Stock B on a.Ident = B.Ident -- doesn't find key anymore on (Generate SQL tab)

What does refreshrecord actually do? If I have a "constrainted" select query and after inserting a record Refreshrecord is called, I get an error "Record changed by another user".
i.e.:
select * from items where Type = 1

insert item with Type = 2(!) and then after a call to RefreshRecord error occours "Record changed by another user"). If I understand correctly, It should refresh record using Refresh SQL statement in UpdateSQLs. Is there something else that must be set?

Frenk

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Fri 23 Sep 2005 07:42

The problem is that SQL Generator doesn't allow to process complex queries. At that case you have to write SQLRefresh manually. As alternative, use WHERE clause instead of JOIN.

Post Reply