Showing posts with label Fill Array With DataTable. Show all posts
Showing posts with label Fill Array With DataTable. Show all posts

Friday, March 11, 2011

Fill Array With DataTable in C#.Net

// Create Array to hold the data of DataTable
object[,] DataArray = new object[dt.Rows.Count, dt.Columns.Count];

//Fill DataTable in Array
for (int row = 0; row < dt.Rows.Count; row++)
{
DataRow dr = dt.Rows[row];
for (int col = 0; col < dt.Columns.Count; col++)
{
arr[row, col] = dr[col];
}
}