Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SQL

0 views
Skip to first unread message

Stijn Vanderfeesten

unread,
Nov 23, 1999, 3:00:00 AM11/23/99
to
Hello,

I'm having trouble with sql. I have created a querie from tree tables
(paradox) and between certain dates.
This worked fine and I placed the the result in a dbgrid. Now I want to
check a field in this querie result and depending on the value I want to
fill in a value in this sql result. This doesn't work, I always get the
message 'can not modify a read-only table'
Does anyone know what I'm doing wrong.

TNX
Stijn

Sti...@Stijn.be
Stijn.Van...@advalvas.be


Dirk Kleist

unread,
Nov 23, 1999, 3:00:00 AM11/23/99
to
A Query from different Talbles works like a view so in case of an update of
one or more fields BDE does not know, what values to fill in in the other
tables.
Try to use another query for the update for the target table like UPDATE
TABLE1 SET Field1 = :Param1 WHERE Filed2 = 'something' and execute it with
TQuery.execute and then reopen the first table to see the results
Hope this helps.

Dirk Kleist (D.Kl...@img-tech.de)

Stijn Vanderfeesten <Sti...@Stijn.be> schrieb in im Newsbeitrag:
81dg66$smo$1...@nickel.uunet.be...

Steve Koterski

unread,
Nov 23, 1999, 3:00:00 AM11/23/99
to
On Tue, 23 Nov 1999 08:36:09 +0100, "Stijn Vanderfeesten"
<Sti...@Stijn.be> wrote:

>I'm having trouble with sql. I have created a querie from tree tables
>(paradox) and between certain dates.
>This worked fine and I placed the the result in a dbgrid. Now I want to
>check a field in this querie result and depending on the value I want to
>fill in a value in this sql result. This doesn't work, I always get the
>message 'can not modify a read-only table'
>Does anyone know what I'm doing wrong.

Multi-table local SQL queries will nearly always be read-only. You cannot
use editing methods of TQuery (like Edit and Insert) on such read-only
queries.

One way you can handle this situation is to enable cached updates and use
an update object (like TUpdateSQL) to apply cached updates to the base
tables. This approach gives the appearance and functionality of an editable
query result set in a grid -- even for a multi-table query.

Another approach (Client/server edition and above) is to operate on the
data via a TClientDataSet component. Conceptually, this is like using
cached updates. But the caching and applying updates is all contained in
the ope component. And TClientDataSet is programmed to do a better job of
it.

And still another approach would be to use a separate TQuery to update the
tables. Use the TDBGrid to select the record to update. Use non-data-aware
controls in a dialog to enter the data. Then use those values in an UPDATE
or INSERT statement executed from a TQuery other than the one used to
retrieve the original result set.

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
Steve Koterski "Health nuts are going to feel stupid someday,
Felton, CA lying in hospitals dying of nothing."
-- Redd Foxx

Dirk P.C. Wendt

unread,
Nov 23, 1999, 3:00:00 AM11/23/99
to

Stijn Vanderfeesten schrieb in im Newsbeitrag:
> Hello,

>
> I'm having trouble with sql. I have created a querie from tree tables
> (paradox) and between certain dates.
> This worked fine and I placed the the result in a dbgrid. Now I want to
> check a field in this querie result and depending on the value I want to
> fill in a value in this sql result. This doesn't work, I always get the
> message 'can not modify a read-only table'
> Does anyone know what I'm doing wrong.

IMHO, you must set RequestLive to true.

Ciao Dirk.

0 new messages