I have a table with the following schemas:
GarantiaImovel | imovelID | GarantiasTipos
12 | 3 | Caução2
12 | 4 | Depósito
12 | 5 | Caução2
12 | 5 | Fiador
12 | 5 | Seguro Fiança
Then I have the following Query
:
var garantias = (from p in db.T_GarantiasLocaticias
where p.imovelID == 5
select p.GarantiasTipos).ToList();
My intention in this Query
is to return the three rows in the table above with the GaantiasTipo
column, but I using foreach
and it only returns me the last line as I can return in the following structure:
foreach (var garantia in garantias)
{
lblGarantiaLocaticias.Text = garantia + ", ";
}
How to proceed?