Tuesday, September 8, 2009

No data exists for the row/column

I got the error when i used the Code like;
rdr = cmd.ExecuteReader();
string strBAL = rdr.GetValue(0).ToString();


The Solution is that we need to introduce rdr.Read() method to start the read process.
rdr = cmd.ExecuteReader();
rdr.Read();
string strBAL = rdr.GetValue(0).ToString();


Reference:
http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/98cbd8de-28f9-402c-8a88-60464d6ed59d

Regards & Ramadhan Kareem
Fauzi