On Tue, 2006-03-14 at 08:48 -0800, johnf wrote:
> On Tuesday 14 March 2006 08:37, Michael Van Canneyt wrote:
> > On Tue, 14 Mar 2006, johnf wrote:
> > > On Tuesday 14 March 2006 08:01, Michael Van Canneyt wrote:
> > >> On Tue, 14 Mar 2006, johnf wrote:
> > >>> On Tuesday 14 March 2006 07:48, Michael Van Canneyt wrote:
> > >>>> On Tue, 14 Mar 2006, johnf wrote:
> > >>>>>> You must set the database property of your SQLQuery1:
> > >>>>>>
> > >>>>>>   self.SQLTransaction1.DataBase:= data3.DataModule1.PQConnection1;
> > >>>>>>   SQLQuery1.Database:=data3.DataModule1.PQConnection1;
> > >>>>>>
> > >>>>>> Michael.
> > >>>>>
> > >>>>> 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';
> > >>>>>
> > >>>>> I still get 'Database not assigned'.  I'm beginning to wonder if
> > >>>>> after making the connection I loose the connection because it goes
> > >>>>> out of scope. Since I'm a newbie - I really don't know what I'm
> > >>>>> doing.  Is there a better way to present this question?
> > >>>>
> > >>>> For testing:
> > >>>> Can you drop the database component on the form, not on the datamodule
> > >>>> ? See how far that gets you ?
> > >>>>
> > >>>> Also: normally I would expect you to set the databasename before you
> > >>>> connect it to the query.
> > >>>>
> > >>>>
> > >>>> Michael.
> > >>>
> > >>> I'm so sorry Michael I don't understand what you mean by "database
> > >>> component" - did you mean the TPQConnection ?  I set the database name
> > >>> in the TPQConnection (in login form).
> > >>
> > >> Yes.
> > >>
> > >> - Drop this TPQConnection component on the same form as the query.
> > >> - Set Databasename.
> > >> - Connect SQLQuery component.
> > >> - Connect transaction component.
> > >> - Set SQL
> > >> - Open.
> > >>
> > >> Michael.
> > >
> > > The above works so what am I missing?  I have attempted to find the
> > > difference without success.
> >
> > 2 things spring to mind:
> > - The order of things seems to be important ?
> > - when the TPQconnection is on the datamodule, is it correctly initialized
> > before you connect your SQLQuery to it ?
> >
> > Michael.
> 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.

-- 
Met vriendelijke groeten,

  Joost van der Sluis
  CNOC Informatiesystemen en Netwerken
  http://www.cnoc.nl

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

Reply via email to