OK, thanks I think I got it. I have it working at this time. Sorry it took
so long to understand that you had not established the parent child relation
during design time.
One trick you used was the 'AfterScroll'. You must of realized that the
'AfterScroll' fires when the dbgrid is populated. I hope to understand the
event model soon. Any hints?
Thanks again and now I have more information for my 'newbie using SQLdb'
article.
John
On Thursday 30 March 2006 09:47, Joost van der Sluis wrote:
> > 1. Does the relation of the parent and child have to be based on numbers?
> > I ask this because of the fact that a primary key must be a number
> > currently. I was not able to determine the data type from your example.
>
> No, only ApplyUpdates need the primary key to be a number. (which is a
> bug, actually)
>
> > 2. I noticed the indexdefs was set on the sqlquerys on your forms. It
> > appears that indexdefs is a list (array?). But is it used? If is is
> > used - how is it used?
>
> Well, it contains the indexes. Not that sqldb does something with them.
> The only thing is that they are used to find what the primary key is.
>
> Btw: if you open a tsqlquery, and ParseSQL is true, it'll get a list of
> indexes which do exist on that table from the DB-server. That's how it
> finds out what the primary key is.
>
> > 3. I noticed that the child relation is moved/set in the code. The code
> > below is the example from your code. And wonder if this is required or
> > there was some other reason. I would have expected sqlquery2 (child) to
> > follow sqlquery1 (parent).
>
> As said, master-detail isn't supported by sqldb yet, so I made it
>
> myself, with the lines of code below:
> > procedure TFBedrijven.QBedrijvenAfterScroll(DataSet: TDataSet);
> > begin
> > SaveData;
> > with QRelaties do
> > begin
> > if Active then close;
> > Params.ParamByName('bedrijfid').asinteger :=
> > Dataset.fieldbyname('bedrijfid').AsInteger;
> > open;
> > end;
> > end;
> >
> > procedure TFBedrijven.QRelatiesAfterInsert(DataSet: TDataSet);
> > begin
> >
> > Dataset.FieldByName('bedrijfid').Assign(QBedrijven.fieldbyname('bedrijfid
> >')); end;
> >
> > John
> >
> > On Thursday 30 March 2006 01:27, Joost van der Sluis wrote:
> > > You could implement Master-detail in sqldb, or look at an example here:
> > > http://www.cnoc.nl/fpc/pgg/
> > >
> > > That program is written for a sort of demonstration we've had here in
> > > the Netherlands. (It's in Dutch, but I suppose you can sort it out, the
> > > code is in the .tgz file)
> > >
> > > On Thu, 2006-03-30 at 00:12 -0800, johnf wrote:
> > > > Hi,
> > > > Could someone explain how to setup a Master Detail using the SQLdb or
> > > > a link to something explaining what to do.
> > > >
> > > > John
> > > >
> > > > _________________________________________________________________
> > > > To unsubscribe: mail [EMAIL PROTECTED] with
> > > > "unsubscribe" as the Subject
> > > > archives at http://www.lazarus.freepascal.org/mailarchives
> >
> > _________________________________________________________________
> > To unsubscribe: mail [EMAIL PROTECTED] with
> > "unsubscribe" as the Subject
> > archives at http://www.lazarus.freepascal.org/mailarchives
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives