Hello,
I am trying to convert a string array to int array using the following code:
stringArray[i, 0] = (Reader["Test"].ToString());
stringArray[i, 1] = (Reader["Test1"].ToString());
stringArray[i, 2] = (Reader["Test2"].ToString());
int toInt0 = Int32.Parse(stringArray[i, 0]);
int toInt1 = Int32.Parse(stringArray[i, 1]);
int toInt2 = Int32.Parse(stringArray[i, 2]);
intArray[i, 0] = toInt0;
intArray[i, 1] = toInt1;
intArray[i, 2] = toInt2;
I get the following error:
System.FormatException: Input string was not in a correct format.
at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
at System.Int32.Parse(String s)
at Book.button1.test() in C:\Users\Dave\Documents\Visual Studio 2010\Projects\Book\Form1.cs:line 603 Exception caught.
What should i fix ?
Thanks,
Dave