top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to loop through all the rows in the Data Table?

0 votes
381 views
How to loop through all the rows in the Data Table?
posted May 15, 2017 by Madhavi Kumari

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Below code is used to loop all rows in a datatable:

DataTable dt = new DataTable();
SqlDataAdapter adapter = new SqlDataAdapter(cmd);
adapter.Fill(dt);
foreach(DataRow row in dt.Rows)
{
    TextBox1.Text = row["ImagePath"].ToString();
}
answer May 17, 2017 by Shweta Singh
...