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. -- Leonardo M. Ramé http://leonardorame.blogspot.com -- _______________________________________________ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus