| View previous topic :: View next topic |
| Author |
Message |
Lasse Guest
|
Posted: Sun Oct 05, 2003 7:05 pm Post subject: How to handle updates of multi tables ? |
|
|
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
|
Posted: Sun Oct 05, 2003 7:44 pm Post subject: Re: How to handle updates of multi tables ? |
|
|
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
|
Posted: Mon Oct 06, 2003 10:45 am Post subject: Re: How to handle updates of multi tables ? |
|
|
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
|
Posted: Mon Oct 06, 2003 10:51 am Post subject: Re: How to handle updates of multi tables ? |
|
|
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
|
Posted: Mon Oct 06, 2003 12:41 pm Post subject: Re: How to handle updates of multi tables ? |
|
|
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 |
|
 |
|