Yves Larock

Yves Larock

  • NA
  • 88
  • 1.4k

datagridview did not show all data of database.

Jan 20 2016 5:04 AM
datagridview did not show all data of database it only show one data.
 
DataTable dt = new DataTable();
dt = blcat.getallcategory();
if (dt.Rows.Count > 0)
{
dataGridView1.Rows.Add();
dataGridView1.Rows[i].Cells["calcategory_id"].Value = dt.Rows[0]["category_id"].ToString();
dataGridView1.Rows[i].Cells["calcategory"].Value = dt.Rows[0]["category_name"].ToString();
i++;
}

Answers (7)