I am trying to populate a list or list from a database using C #. I use datatable to collect data. I am using this code below. But listview or listbox populate something like text "System.Data.DataRow". Where I have something else in my database. Please, help
query = "select itemtag from tbl_inventory order by itemtag";
DataTable dt = con.DataTable(query);
int count = dt.Rows.Count;
if (count >0)
{
listBox1.Items.Clear();
for (int i = 0; i < count; i++)
{
listBox1.Items.Add(dt.Rows[i].ToString());
}
}
where I have something else in my database
Any help?
source
share