Board index » delphi » Need help: SQL query problem.

Need help: SQL query problem.

I am having trouble using Calculated Fields in an TQuery component.

I assigned an event handler to the OnCalcField event in my TQuery, which
is supposed to fill-in a new field using other fields. This
event-handler works fine with a regular TTable.

When the event-handler is run by the OnCalcFields event of the TQuery,
an exception is raised:

  Project <___>.exe raised exception class EDatabaseError with message
'Cannot
  modify a read-only dataset'. Process stopped. Use Step or Run to
continue.

I checked the read-only property CanModiy and it is false, but I cannot
change it.

How do I make this work? How do I modify a record in a TQuery.

Please... any suggestions...

Erez Steinberg,
ere...@ibm.net

 

Re:Need help: SQL query problem.


On Wed, 02 Sep 1998 14:13:46 +0300, Erez Steinberg <ere...@ibm.net>
wrote:

Quote
>I am having trouble using Calculated Fields in an TQuery component.

>I assigned an event handler to the OnCalcField event in my TQuery, which
>is supposed to fill-in a new field using other fields. This
>event-handler works fine with a regular TTable.

>When the event-handler is run by the OnCalcFields event of the TQuery,
>an exception is raised:

>  Project <___>.exe raised exception class EDatabaseError with message
>'Cannot
>  modify a read-only dataset'. Process stopped. Use Step or Run to
>continue.

>I checked the read-only property CanModiy and it is false, but I cannot
>change it.

>How do I make this work? How do I modify a record in a TQuery.

>Please... any suggestions...

>Erez Steinberg,
>ere...@ibm.net

If you use "SELECT DISTINCT"  the TQuery sets ReadOnly by default, and
you can't modify the results.

If not, then you have to set the RequestLive property to True. The

Oscar Felis
2 + 2 = 4 they say...

Re:Need help: SQL query problem.


Is it possible to perform your calculations in the SQL of the query?

eg

select description, quantity, cost, (cost * quantity) as line_value from
detail where ......

Barbara

Quote
Erez Steinberg wrote in message <35ED2869.41705...@ibm.net>...
>When the event-handler is run by the OnCalcFields event of the TQuery,
>an exception is raised:

Other Threads