Op woensdag 12-12-2007 om 16:32 uur [tijdzone +0200], schreef Graeme
Geldenhuys:
> On 12/12/2007, Joost van der Sluis <[EMAIL PROTECTED]> wrote:
> >
> > > Step 2:
> > You don't need to do this. It is used when the TIBConnection tries to
> > execute some sql-statements itself. If has to know which transaction it
> > should use. You have to see this as the 'default transaction'. If you do
> > TIBConnection.ExecuteDirect, this transaction is used. This transaction
> > is also used when you use ApplyUpdates.
> >
> 
> <....snip....>
> 
> > > Step 5b: (optional)
> > > ======
> > > TSQLQuery  ->  TDatasource via the 'DataSource' property.  It can be
> > > done, but wasn't needed to get my example project to work. Not sure
> > > what's the rules about this one.
> >
> > I've been mistaken about this one more then once. Also my collegues had
> > problems with this.
> > iirc it's renamed to something else in recent versions. What it does is
> > handling the master-detail relationships.
> 
> 
> I have to beg to differ on both counts!  They are both required, see below.

Both counts? 5b Is optional? You said that yourself.

> I could send you my project if it might help.
> 
> 
> As for Step 5. Well in my simple example I have a query: "Select * from 
> users".
> No master-detail relationship there! Yet if I try to set the
> TSQLQuery.Active = True I get a "Database not assigned!" error.
> Assign the "Database" property to IBConnection1 and try Active = True again.

That's step 4. I didn't say you don't need it. I only never considered
this strange.

> This time I get the following error:  "Transaction of connection not
> set".  Now I go to the IBConnection1 and set the Transaction (doubly
> link madness) and no I'm not trying to execute anything directly via
> the IBConnection.  Go back to SQLQuery and set Active = True.  Now
> everything works and I get results in the DBGrid.

That's because you don't have any indexes pre-defined. So it tries to
fetch the indexes from the database. At that point the TIBConnection
needs a transaction... Set TSQLQuery.ParseSQL:=false; Then you don't
need step 2 anymore. For your OPF you have to set it to false anyways,
since it's useless in your case.

> So bottom line - all the steps from my first email *are* required to
> get results in a DBGrid.

Well, depends. 5b not, and 2 also not if you set ReadOnly to true or
parseSql to false.

Joost

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to