How to display retrieved data from database in jagged array?
How to display retrieved data from database in jagged array?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Posted Mar 20, 2014, 1:05 AM
First fill all the database record as into a data table then declare a jagged array with length same as table's row count.Retrieve all the row using loop and inside the loop declare array whose length would same as total number of columns of data table.
Fore Example,
Suppose your table object is DT,
Then
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;
}
i think above will helpful to you, kindly mark as answer it is helpful to you;
Abhijeet SinghPosted Mar 20, 2014, 4:21 AM