Windows Phone Developers

Friday, April 23, 2010

SQLDataReader - Invalid attempt to read when no data is present

The error occurs when there no data is returned / the data has not been read.

The first case can be checked using HasRows flag

If the data is not read it can be done as follows:

SqlDataReader rdr = Cmd.ExecuteReader();

            while (rdr.Read() == true)
              string sName =  rdr.GetString(1);

Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

No comments:

Post a Comment