private void FillList()
{
listView.Items.Clear();
DataTable dtPeople = GetPeople();
listView.BeginUpdate();
foreach (DataRow dr in dtPeople.Rows)
{
ListViewItem listItem = new ListViewItem(dr["id"].ToString());
listItem.ImageIndex = 0;
// Get child rows from a parent one.
// person_name is a name of relation between two
// tables.
DataRow[] r = dr.GetChildRows("person_name");
if (r.Length != 0)
{
listItem.SubItems.Add(r[0][0].ToString());
listView.Items.Add(listItem);
}
if (listView.Columns.Count == 0)
{
listView.Columns.Add("ID", 100, HorizontalAlignment.Left);
listView.Columns.Add("Name", 100, HorizontalAlignment.Left);
}
listView.EndUpdate();
}
}
I am having problem understanding foreach (DataRow dr in dtPeople.Rows)
What is dr
When I retype the code into my VS It shows me error, that he can't find "dr"....
Thanks in advance...