Populate a listview with 2 BO


Author
Message
David Daragon
David Daragon
StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)
Group: Forum Members
Posts: 54, Visits: 249
Hi,

I have a listview in my form.

I succeed to populate it with this method:

public void RecupererToutesVilles()
{
SqlCommand _maRequeteSQL = new SqlCommand();

_maRequeteSQL.CommandText = "SELECT Pk_DaVille, Libelle, CodePostal, Fk_DaPays, PhxLibelle, MajLibelle FROM L_DaVille";
this.FillDataTable(_maRequeteSQL);
}

But in my listview, I have a foreign key of a country whereas I want to see the name of the country.
So I want my query to be like these.

_maRequeteSQL.CommandText = "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)";

I tried to add a display field called F_DaPays.Libelle in the PopulationDataSourceSettings but I have an error.

Can someone help me please.
Regards,

David

Reply
Michel Levy
Michel Levy
Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)
Group: StrataFrame Users
Posts: 193, Visits: 9K
Pourquoi? une fois ta vue définie sur ton serveur, tu peux la requèter depuis un BO en définissant une méthode FillDataTable, que tu choisiras pour peupler ton ListView.

Il me semble que c'est l'expérience VFP qui te manque, là BigGrin. 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.

--

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.

It seems as a missing VFP background BigGrin. All list controls are double data-binded: on the one hand for populating, on the other hand for setting a value to a field.

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search