i am trying to print Datatable column name along with there values but i am getting error
Row does not exist in current context
my code below.have tried the solution of How do I get column names to print in this C# program? but not working
foreach (DataRow row in dtfinal.Rows)
{
foreach (DataColumn col in dtfinal.Columns)
Console.WriteLine(col.ColumnName);
Console.WriteLine(row[col]); //error coming here
}