Board index » delphi » Tquery edit problem

Tquery edit problem

Hi all,

I was just wandering how I can force my TQuery (complete with working SQL)
to .edit mode ??

Its always saying its a readonly dataset, but Id like to know if there is
anyway to overcome this readonly problem..

Thanks all
Mick

 

Re:Tquery edit problem


Hi Mick,

Set your query.requestlive = true.
Never use joined tables (FROM only one table)
Never use DISTINCT, aggregate functions, GROUP BY, HAVING in the SQL
A unique index is required unless the table is from Oracle server.

then you can use Query.Edit Append Insert ... Post (or ApplyUpdates/CommitUpdates)

Rudy
=====================================

Quote
Mick Jagger wrote:

> Hi all,

> I was just wandering how I can force my TQuery (complete with working SQL)
> to .edit mode ??

> Its always saying its a readonly dataset, but Id like to know if there is
> anyway to overcome this readonly problem..

> Thanks all
> Mick

Re:Tquery edit problem


Quote
Mick Jagger wrote:

> Hi all,

> I was just wandering how I can force my TQuery (complete with working SQL)
> to .edit mode ??

> Its always saying its a readonly dataset, but Id like to know if there is
> anyway to overcome this readonly problem..

> Thanks all
> Mick

Good thing you finally accepted the fact that you can't sing, and
decided to change careers Mick ....

;)

Rkr
--

                   \|||/
                   /'^'\
                  ( 0 0 )
--------------oOOO--(_)--OOOo--------------
. Reid Roman                              .
. Delphi Programmer                       .
. TVisualBasic:=class(None)               .
. May the Source be With You              .
-------------------------------------------
. Auto-By-Tel (http://www.autobytel.com)  .
. Irvine, CA U.S.A                        .
. E-Mail : rkroman (at) home (dot) com    .
-------------------------------------------

Re:Tquery edit problem


On Tue, 30 Mar 1999 21:45:05 +1000, "Mick Jagger" <jagg...@ozemail.com.au>
wrote:

Quote
>I was just wandering how I can force my TQuery (complete with working SQL)
>to .edit mode ??

>Its always saying its a readonly dataset, but Id like to know if there is
>anyway to overcome this readonly problem..

There are quite a number of factors that can affect whether a query result
set is read-only or updatable -- and you did not supply any. It would be
hard to give any specific recommendations without that background
information.

The foremost factor is the TQuery.RequestLive proeprty. Its default value
of False means the result set will be read-only, no matter the factors that
follow below. Trying setting RequestLive to True. Even if you do, though,
if the database back-end cannot return a live result set it will still be
read-only. Inspect the CanModify property to determine whether the attempt
at a live result set was successful.

The SQL statement itself can affect the ability to get an updatable result
set. All multi-table result sets will be read-only. But single-table result
sets may of may not be, depending on how they are composed, what features
they use, and what database system is used. For instance, what may be a
read-only result set in local SQL (dBASE and Paradox tables) may be an
updatable result set in an SQL database system (like Interbase, Oracle, or
Sybase).

One alternative when a desired result set would always be read-only is
using the TClinetDataSet component to retrieve the data. However, this
component is only available in the Enterprise edition (Client/Server in
Delphi 3 and below). Another alternative is cached updates. With this
feature, changes to an otherwise read-only result set are cached and then
applied as a batch process using update objects (like TUpdateSQL). The
data-aware controls give the end-user the appearance of an updatable
dataset.

//////////////////////////////////////////////////////////////////////////
Steve Koterski                 "Like a camel, I can go without a drink for
Technical Publications         seven days--and have on several horrible
INPRISE Corporation            occasions."
http://www.borland.com/delphi                                 -- Herb Caen

Other Threads