Sunday, September 13, 2009

Convert DataSet to Array List

public static ArrayList DataSetToArrayList(string Columns, DataTable dataTable)

{

ArrayList output = new ArrayList();

string[] columnName = Columns.Split(',');

foreach (DataColumn row in dataTable.Columns)

{

foreach (string column in columnName)

{

if (column == row.ColumnName)

output.Add(column);

}

}

return output;

}

No comments: