﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » WinForms (How do I?)  » Populate a listview with 2 BO</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Tue, 09 Jun 2026 00:02:11 GMT</lastBuildDate><ttl>20</ttl><item><title>Populate a listview with 2 BO</title><link>http://forum.strataframe.net/FindPost19047.aspx</link><description>Hi,&lt;P&gt;I have a listview in my form.&lt;/P&gt;&lt;P&gt;I succeed to populate it with this method:&lt;/P&gt;&lt;P&gt;[code]&lt;FONT size=2&gt;&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;public&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;void&lt;/FONT&gt;&lt;FONT size=2&gt; RecupererToutesVilles()&lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;{&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;SqlCommand&lt;/FONT&gt;&lt;FONT size=2&gt; _maRequeteSQL = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;ne&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;w&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;SqlCommand&lt;/FONT&gt;&lt;FONT size=2&gt;();&lt;/P&gt;&lt;P&gt;_maRequeteSQL.CommandText = &lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;"SELECT Pk_DaVille, Libelle, CodePostal, Fk_DaPays, PhxLibelle, MajLibelle FROM L_DaVille"&lt;/FONT&gt;&lt;FONT size=2&gt;;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;this&lt;/FONT&gt;&lt;FONT size=2&gt;.FillDataTable(_maRequeteSQL);&lt;BR&gt;}&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;[/code]&lt;/P&gt;&lt;P&gt;But in my listview, I have a foreign key of a country&amp;nbsp;whereas I want to see the name of the country.&lt;BR&gt;So I want my query to be like these.&lt;/P&gt;&lt;P&gt;[code]&lt;/P&gt;&lt;P&gt;_maRequeteSQL.CommandText = &lt;FONT color=#a31515 size=2&gt;"SELECT Pk_DaVille, L_DaVille.Libelle, CodePostal, Fk_DaPays, F_DaPays.Libelle, L_DaVille.PhxLibelle, L_DaVille.MajLibelle FROM L_DaVille INNER JOIN F_DaPays ON (L_DaVille.Fk_DaPays = F_DaPays.Pk_DaPays)"&lt;/FONT&gt;&lt;FONT size=2&gt;;&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;[/code]&lt;/P&gt;&lt;P&gt;I tried to add a display field called&lt;FONT size=+0&gt; F_DaPays.Libelle in the PopulationDataSourceSettings but I have an error.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Can someone help me please.&lt;BR&gt;Regards,&lt;/P&gt;&lt;P&gt;David</description><pubDate>Mon, 08 Sep 2008 03:23:31 GMT</pubDate><dc:creator>David Daragon</dc:creator></item><item><title>RE: Populate a listview with 2 BO</title><link>http://forum.strataframe.net/FindPost19161.aspx</link><description>Thanks Michel&lt;/P&gt;&lt;P&gt;I tried and it works.</description><pubDate>Mon, 08 Sep 2008 03:23:31 GMT</pubDate><dc:creator>David Daragon</dc:creator></item><item><title>RE: Populate a listview with 2 BO</title><link>http://forum.strataframe.net/FindPost19102.aspx</link><description>Pourquoi? une fois ta vue définie sur ton serveur, tu peux la requèter depuis un BO en définissant une méthode&amp;nbsp;FillDataTable, que tu choisiras pour peupler ton ListView.&lt;P&gt;Il me semble que c'est l'expérience VFP qui te manque, là :D. Tous les controles de type liste sont doublement liés aux données: d'une part pour les peupler, d'autre part pour affecter leur valeur à un champ.&lt;/P&gt;&lt;P&gt;--&lt;/P&gt;&lt;P&gt;Why? when your view is defined on your server, you may query it from a BO, using a FillDataTable method, and you'll choose that method to fill the ListView.&lt;/P&gt;&lt;P&gt;It seems as a missing VFP background :D. All list controls are double data-binded: on the one hand for populating, on the other hand for setting a value to a field.</description><pubDate>Fri, 05 Sep 2008 07:42:21 GMT</pubDate><dc:creator>Michel Levy</dc:creator></item><item><title>RE: Populate a listview with 2 BO</title><link>http://forum.strataframe.net/FindPost19098.aspx</link><description>[quote]David, &lt;P&gt;Ta&amp;nbsp;requète comporte un JOIN, le mieux est de créer une vue sur ton serveur SQL (éventuellement en lecture seule), tu profiteras au mieux du plan d'optimisation de SQL.&lt;BR&gt;Et tu pointes ta requète sur cette vue pour peupler ton Listview&lt;/P&gt;&lt;P&gt;--&lt;/P&gt;&lt;P&gt;You have a JOIN in your query, so you'd create a view on your SQL&amp;nbsp;server (possibly read-only) to benefit from SQL execution plan.&lt;BR&gt;And you query against that view to populate your Listview &lt;/P&gt;&lt;P&gt;[/quote]&lt;/P&gt;&lt;P&gt;Cela veut donc dire que je ne passe pas par un BO (ni donc par la propriété PopulationDataSourceSettings) pour peupler ma liste mais directement via une requête qui attaquera ma vue ?</description><pubDate>Fri, 05 Sep 2008 06:33:15 GMT</pubDate><dc:creator>David Daragon</dc:creator></item><item><title>RE: Populate a listview with 2 BO</title><link>http://forum.strataframe.net/FindPost19059.aspx</link><description>David,&lt;/P&gt;&lt;P&gt;Ta&amp;nbsp;requète comporte un JOIN, le mieux est de créer une vue sur ton serveur SQL (éventuellement en lecture seule), tu profiteras au mieux du plan d'optimisation de SQL.&lt;BR&gt;Et tu pointes ta requète sur cette vue pour peupler ton Listview&lt;/P&gt;&lt;P&gt;--&lt;/P&gt;&lt;P&gt;You have a JOIN in your query, so you'd create a view on your SQL&amp;nbsp;server (possibly read-only) to benefit from SQL execution plan.&lt;BR&gt;And you query against that view to populate your Listview</description><pubDate>Thu, 04 Sep 2008 10:38:24 GMT</pubDate><dc:creator>Michel Levy</dc:creator></item></channel></rss>