I can't explain it properly in the subject section, it's not as simple as that. Here is the code snippet in question.
UserPass = reader["Password"].ToString();
So UserPass is my string variable and reader is an SqlReader object. Here is it being instantiated:
SqlDataReader reader = myCommand.ExecuteReader();
(myCommand is an SqlCommand obj)
reader["Password"]
Password is a column name in my Sql DB. Basically I've just told the reader to go look within that column and used a query to specify where abouts. I want to set the reader["Password"] equal to an empty string to compare against user input. Now there aren't any errors when I do this but it does throw an exception:
An exception of type 'System.InvalidOperationException' occurred in System.Data.dll but was not handled in user code
It doesn't give much more detail other than that and I'm not entirely sure what's wrong.