Retrieved Data from Database in Jagged Array

Introduction
 
This article describes the method of inserting a database record into the jagged array, the new concept in Visual Studio 2013.
 
Jagged Array
 
A jagged array is an array whose elements are arrays. The elements of a jagged array can be of different dimensions and sizes. A jagged array is sometimes called an "array of arrays." The following examples show how to declare, initialize, and access jagged arrays.
 
Getting Started
 
Suppose your table object is DT,

Then,
object[][] jaggedArray = new object[DT.Rows.Count][];
for(int ind=0;ind< DT.Rows.Count;ind++)

{

object[] array=new array
[DT.Columns.Count];
for(int ind1=0;ind1< DT.
Columns.Count;ind1++)
{

array[ind1]=DT.Rows[ind][ind1];

}
jaggedArray[ind] =array;
}

The above code inserts a record from the database to the jagged array.
Ebook Download
View all
Learn
View all