Thursday, April 21, 2011

C# printing column names of datatable

Ah ..sometimes simple tasks baffle me...Here is a function to print column names of a datatable


private void PrintColumnNames(DataTable dt)
{
    // For each column, print the ColumnName.
        foreach(DataColumn column in dt.Columns)
        {
            Response.Write(column.ColumnName);
        }
}

No comments: