I can't figure why my data grid is displaying the last table recording from an Sqlite database. here is the code I've writen.
ObservableCollection<Activity> _activitiesList = new ObservableCollection<Activity>();
while (reader.Read())
{
_act.Name = reader.GetString(reader.GetOrdinal("Activity"));
_act.Customer = reader.GetString(reader.GetOrdinal("ActivityCustomer"));
_act.Activitytpe = reader.GetString(reader.GetOrdinal("ActivityNature"));
string st = reader.GetString(reader.GetOrdinal("StartedAt"));
_act.StartedAt = Convert.ToDateTime(st);
string et = reader.GetString(reader.GetOrdinal("FinishedAt"));
_act.EndedAt = Convert.ToDateTime(et);
//string _ratio = reader.GetString(reader.GetOrdinal("ActivityRatio"));
//_act.ActivityRatio = Convert.ToDouble(_ratio);
_act.Notes = reader.GetString(reader.GetOrdinal("Notes"));
string _hldy = reader.GetString(reader.GetOrdinal("Holiday"));
_act.IsHoliday = Convert.ToBoolean(_hldy);
_activitiesList.Add(_act);
}
ActivitiesDataGrid.ItemsSource=_activitiesList;
Aucun commentaire:
Enregistrer un commentaire