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,

Mailing lists / lazarus / 2011-04
8 messages · 4 people · –
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
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.
Hi Leonardo,
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20110417/f48b67c0/attachment.html>
2011/4/17 Peter Williams :
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.
Why not just follow his instructions... you might learn more that way (instead of simply copy-and-pasting code).
Hi Graeme,
I could not follow his instructions. And you are not help either. Best Regards,Peter / pew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20110417/5108fb2d/attachment.html>
2011/4/17 Peter Williams :
I could not follow his instructions. And you are not help either.
I did not mean to come across as rude, I just don't think being spoon-fed is very useful. Expecting somebody else to create a fully working code example for you, is just wishful thinking. We are all busy people. From my past experience, and from looking at the programmers that work for me, copy-and-paste coding teaches nobody anything. Following some instructions, and working through the details and problems you experience along the way, is the best way of learning. You will probably remember it better for a next time too.
I would like to see your solution. I am wondering if you could please make a demo Lazarus…
Peter Williams wroteHi Leonardo,
...
Hi,
I made an example of a master-detail-subdetail application : http://mantis.freepascal.org/view.php?id=18491. It uses the Firebird employee-database.
There is a bug in the subdetail-handling. But master-detail works fine.
HTH,
Koenraad Lelong
Hi,
Thanks. I will study it over the next few days.
Best Regards,Peter / pew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20110418/d4eb0c0c/attachment.html>