2
Reply

arrays

syed

syed

May 25 2007 1:34 AM
2k
i get values from sqldatareader and store it in array
if i dont initialize array size it will not work and i will be not knowing how much size i have to initialize

how to store values in string array

is my syntax below is correct

{

// Put user code to initialize the page here

int i=0;

i=10;

string[] strarr;if(i==10)

{

strarr="firstvalue;

}

i=20;

if(i==20)

{

strarr="secondvalue";

}

i=30;

if(i==20)

{

strarr="thirdvalue";

}

i=40;

if(i==20)

{

strarr="fourth value";

}

foreach(string str in strarr)

{

Response.Write(str+"<br>");

}

}

 

so finally my code should display

firstvalue

secondvalue

thirdvalue

fourthvalue


Answers (2)