[Lazarus] Master/Detail Relation

Peter Williams pewilliams2010 at live.com
Sun Apr 17 01:15:31 CEST 2011


Hi Leonardo,

> Date: Sat, 16 Apr 2011 18:39:05 -0300
> From: l.rame at griensu.com
> To: lazarus at lists.lazarus.freepascal.org
> Subject: Re: [Lazarus] Master/Detail Relation
> 
> On 2011-04-16 15:56:19 -0300, Leonardo M. Ramé wrote:
> > Hi, I was looking at SqlDb components and I can't find any property to
> > link two datasets in a Master/Detail relation, as in Delphi.
> > 
> > Is such feature already implemented? any tutorial/wiki?.
> > 
> > Thanks in advance,
> > -- 
> 
> I found the solution. 
> 
> For the record:
> 
> SqlQuery1 (master)
> SqlQuery2 (detail)
> 
> In SqlQuery2.Sql.Text I had to add a "where" condition with a param, for
> example:
> 
> select * from a_table where a_field = :field_from_query1
> 
> The param must be a Field from SqlQuery1.
> 
> Then, by code, i had to the param type:
> 
> SQLQuery2.ParamByName('field_from_query1').DataType := ftInteger; 
> 
> The last step is to point SqlQuery2.DataSource to a TDataSource
> associated to SqlQuery1. In my case I have two TDbGrids in form1, each
> grid with a TDataset pointed to SqlQuery1 and SqlQuery2, so in
> SqlQuery2.DataSource I assigned "form1.datasource1", and that's it.
> 
I would like to see your solution. I am wondering if you could please make a demo Lazarus project and zip it up and upload it to http://hotfile.com . It is a file sharing website and then I will be able to see your code.
Thanks in advance.
Best Regards,Peter / pew
> -- 
> Leonardo M. Ramé
> http://leonardorame.blogspot.com
> 
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20110417/f48b67c0/attachment-0003.html>


More information about the Lazarus mailing list