So I have a query that returns values from multiple tables with a left join. But I can't seem to get the data from left join table.
public IEnumerable<TipsTricks> GetTipsTricks()
{
using(var connection = new SqlConnection(Connection.Instance.ConnectionString))
{
return connection.Query<TipsTricks>(@"SELECT tt.ID, cat.Omschrijving, tt.Info, tt.Onderwerp, tt.Firma FROM tblTipsAndTricks as tt
LEFT JOIN tblTT_Categorieen as cat on cat.Id = tt.CategorieID ");
}
}
I then do in code behind to bind it to Datagrid.ItemsSource:
public void initialize()
{
List<TipsTricks> tipstricks = DatabaseManager.Instance.TipsTricksRepository.GetTipsTricks().ToList();
DgTipsTricks.ItemsSource = tipstricks;
}
Class TipsTricks
public class TipsTricks
{
public int Id { get; set; }
public string Info { get; set; }
public string Onderwerp { get; set; }
public string Firma { get; set; }
string Omschrijving { get; set; }
}
Also tried the binding in de XAML without succes.
So I would like a column in the datagrid showing the content of cat.Omschrijving from the left join table tblTT_Categorieen.
Thanks!
Try making the property string Omschrijvin "public"
as shown below
public class TipsTricks
{
public int Id { get; set; }
public string Info { get; set; }
public string Onderwerp { get; set; }
public string Firma { get; set; }
public string Omschrijving { get; set; }
}