BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to handle updates of multi tables ?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (Multi-Tier)
View previous topic :: View next topic  
Author Message
Lasse
Guest





PostPosted: Sun Oct 05, 2003 7:05 pm    Post subject: How to handle updates of multi tables ? Reply with quote



Hi,
I have join query in a dbexpress TSQLQuery and I am trying to update 2
tables by writing code in the providers BeforeUpdateRecord event.
One table update works fine. But with 2 tables it does not work, for example
I get an error that the Field XXXX does not exist. How should I set the
providerFlags in the TSQLQuery?
Does the provider GetTableName event have any function when updating 2
tables, in that case what should I write there ?
Do I need to change some properties in the provider when updating 2 tables ?

Please help
Lasse


Back to top
Bill Todd
Guest





PostPosted: Sun Oct 05, 2003 7:44 pm    Post subject: Re: How to handle updates of multi tables ? Reply with quote



If you need to update fields in both tables you must create and
execute your own SQL statements to perform the updates. You can handle
updates to join where only fields in one of the tables are being
changed by setting the ProviderFlags and using the OnGetTableName
event but you are on your own if fields in both tables must be
updated.


--
Bill (TeamB)
(TeamB cannot respond to questions received via email)
Back to top
Lasse
Guest





PostPosted: Mon Oct 06, 2003 10:45 am    Post subject: Re: How to handle updates of multi tables ? Reply with quote



I forgot to set Applied := True in the BeforeUpdateRecord event.

"Bill Todd" <no (AT) no (DOT) com> skrev i meddelandet
news:prs0ovgin20tfvoc24ocn2brjnki51h0a7 (AT) 4ax (DOT) com...
Quote:
If you need to update fields in both tables you must create and
execute your own SQL statements to perform the updates. You can handle
updates to join where only fields in one of the tables are being
changed by setting the ProviderFlags and using the OnGetTableName
event but you are on your own if fields in both tables must be
updated.


--
Bill (TeamB)
(TeamB cannot respond to questions received via email)



Back to top
Lasse
Guest





PostPosted: Mon Oct 06, 2003 10:51 am    Post subject: Re: How to handle updates of multi tables ? Reply with quote

Ok if I do update both tables in the BeforeUpdateRecord event, does that
mean that I have to construct a query that check if the record have been
changed by other user since I retrieved it?(if I want to know that)
Lasse

"Bill Todd" <no (AT) no (DOT) com> skrev i meddelandet
news:prs0ovgin20tfvoc24ocn2brjnki51h0a7 (AT) 4ax (DOT) com...
Quote:
If you need to update fields in both tables you must create and
execute your own SQL statements to perform the updates. You can handle
updates to join where only fields in one of the tables are being
changed by setting the ProviderFlags and using the OnGetTableName
event but you are on your own if fields in both tables must be
updated.


--
Bill (TeamB)
(TeamB cannot respond to questions received via email)



Back to top
Bill Todd
Guest





PostPosted: Mon Oct 06, 2003 12:41 pm    Post subject: Re: How to handle updates of multi tables ? Reply with quote

On Mon, 6 Oct 2003 12:51:23 +0200, "Lasse"
<NOSPAMlars-ake.makiaho (AT) telia (DOT) com> wrote:

Quote:
Ok if I do update both tables in the BeforeUpdateRecord event, does that
mean that I have to construct a query that check if the record have been
changed by other user since I retrieved it?(if I want to know that)
Lasse

Yes. Just use the old values in the WHERE clause. That is how the
Provider ensures that the record has not been changed.

--
Bill (TeamB)
(TeamB cannot respond to questions received via email)

Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (Multi-Tier) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.