IndexOutOfRangeException
IndexOutOfRangeException
(OP)
In my C# application I've retrieved a row of data from a MS-Sql database. While the majority of the data is coming across fine, the data reader in C# is throwing the "IndexOutOfRangeException" message on three columns in the result set. Those columns are defined in SQL as nvarchar(128). One of the columns (SecurityAnswer) contains the following value: 50D8B4A941C26B89482C94AB324B5A274F9CED66
Here's an extract of the code that is failing:
What do I need to do in order to be able to read the data from the Sql table in my C# code?
Steve
Here's an extract of the code that is failing:
CODE
String cSecurityAnswer; cSecurityAnswer = myReader["SecurityAnswer"].ToString();
What do I need to do in order to be able to read the data from the Sql table in my C# code?
Steve
RE: IndexOutOfRangeException
post your query string, please. And some more of your code. Do you check if(myReader.HasRows())?
"Knowledge is power. Information is liberating. Education is the premise of progress, in every society, in every family." (Kofi Annan)
Oppose SOPA, PIPA, ACTA; measures to curb freedom of information under whatever name whatsoever.
RE: IndexOutOfRangeException