Hi all,
I just try to input integer typed table rows into 2D integer array. I've tried the code below but it outputs me only last row :(

``````Input Table :
-----------------------
id    red  green  blue
1101  12   11     13
1102  12   12     14
1103  13   14     13
------------------------
2D Array :   array<Int32,2> ^y_k = gcnew array<Int32,2>(5,4);``````
``````// INPUT TABLE ROWS INTO 2D ARRAY
{
//for(int i=1; i<2; i++)
for(int i=1; i<4; i++)
{
}

}
// CHECKING ARRAY INPUT
for(int j=1; j<4; j++) //column
{
for(int i=1; i<5; i++)  // row
{     					      textBox1->AppendText(Convert::ToString(y_k[i,j])) ;
textBox1->AppendText(" ");
}
textBox1->AppendText("||");

}``````

Why do you have that extra loop in the process?

``````//UNTESTED, but should look something like this:
int i=0;
{
i++;
}``````

Thines01, Thank you 1111111 times .
Now the array outputs all rows . What was the logic, why did you think like that??

You were re-inserting all of the rows (with the inner loop) over top of the elements in the array.
It was actually looping 16 times to put data in the array, when it only needed to loop 4 (given 4 rows).

Sorry thines01, i couldn't see your post. So sorry.
First, could you say how many loops are there (in the code below) :

``````while (reader->Read()) // READS 12 ITEMS
for(int i=1; i<4; i++) // (loops 3*4 times)
{
}
}``````

Finally, could you tell me your idea about the (if any) performance difference btw the following codes ?!

``````while (reader->Read())
for(int i=1; i<4; i++)
{
}
}``````
``````int i=0;
{