On Tuesday 14 March 2006 09:10, Alexandre Leclerc wrote:
> On 3/14/06, Joost van der Sluis <[EMAIL PROTECTED]> wrote:
> > On Tue, 2006-03-14 at 08:48 -0800, johnf wrote:
> > > BTW in the testing I did not set the properties in code but on the
> > > property sheet. Could this be something?
> >
> > Yes. That's why Michael gave you the code in his first reply.
> >
> > There is a bug in Lazarus related to the scope of datamodules. In
> > design-time it doesn't work, but it does if you do it with code.
>
> Exactly, if you connect first, then as suggested (from my memory too)
>
> plug the sqlquery to the opened database:
> > >>> Thanks but it did not work. I added the following:
> > >>> self.SQLQuery1.DataBase:= data3.DataModule1.PQConnection1;
> > >>> self.SQLQuery1.Transaction :=data3.DataModule1.SQLTransaction1;
> > >>> self.SQLQuery1.DataBase.DatabaseName :='Real-Accounting';
>
> this should work without a glitch at run time.
>
> And dont' forget to clese the connection at the end! :) (It's supposed
> to be done automatically???, but clean code is clean code: do it
> yourself!)
>
> --
> Alexandre Leclerc
I think this is working now. I'm not sure because I have not removed some of
the controls. But noticed the changes I made below:
data3.DataModule1.PQConnection1.Transaction:=self.SQLTransaction1;
self.SQLTransaction1.DataBase:= data3.DataModule1.PQConnection1;
self.SQLQuery1.DataBase:= data3.DataModule1.PQConnection1;
self.SQLQuery1.Transaction :=self.SQLTransaction1;
self.SQLQuery1.SQL.Text := 'Select * from arcust';
I added the PQConnection1.Transaction:=self.SQLTransaction1 (because I have a
sqltransaction on the form) also the
self.SQLQuery1.Transaction :=self.SQLTransaction1
and this seems to work. Does this appear to be correct? I wonder if the
issue along was the PQConnection1.Transaction was not set????
John
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives