I have accessed one field from database with datareader.Now I want to check it and the accordinngly want to increase or decrease it.
(e.g. If we got 4 from database and this 4 has been stored in the datareader object(e.g.dr contains 4) now i want to check it aginst 5 if it is 5 then display 6).
I tried below mentioned code for the same -
SqlDataReader dr = null;
dr = cmd.ExecuteReader();
if (dr.GetInt32(0) == 5)
But it is giving Exception in if condition is that Specified cast is not valid.
How it is possible.
Pls help me out.