Tuesday, September 22, 2009

Build DataTable

public static DataTable BuildDataTable(Dictionary columns)
{
DataTable table = new DataTable();
foreach (KeyValuePair pair in columns)
{
if (!table.Columns.Contains(pair.Key))
{
table.Columns.Add(pair.Key, pair.Value);
}
}
return table;
}

No comments: