C# loop through datatable column names

In this post, we will learn about C# loop through datatable column names with an example.

Description:

In my previous posts I have explained various topics like Get site visitor count in asp.net
Convert generic list to datatable in Asp.Net C#.Net, Abstract Class in C# with Example,
Routing in Asp.Net MVC with Example
,Use of Global.asax in Asp.net


Now in this post, I will explain about C# loop through datatable column names with appropriate example.

DataTable  _DataTable;

int _Id,_CategoryId;
string _ItemName;

foreach (DataRow row in _DataTable.Rows)
{
    _Id = Convert.ToInt32(row["ID"]);
    _CategoryId = Convert.ToInt32(row["CategoryID"]);
    _ItemName = Convert.ToString(row["ItemName"]);
}




Read :

Summary

You can also read about ASP.NET, C#.Net, JQUERY, AJAX, JavaScript
I hope you get an idea about C# loop through datatable column names.
I would like to have feedback on my blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you liked this post, don’t forget to share this.

Leave a Reply

Your email address will not be published. Required fields are marked *

Name *
Email *
Website