Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Server Compact does not support calls to HasRows property if the underlying cursor is not scrollable."

What does this actually mean?

I am stepping through some code and when I look at the properties of my datareader under the locals window in vs2010, the DR.HasRows shows an error:

HasRows '(DR).HasRows' threw an exception of   type 'System.InvalidOperationException'  bool {System.InvalidOperationException}

base    {"SQL Server Compact does not support calls to HasRows property if the underlying cursor is not scrollable."}   System.SystemException {System.InvalidOperationException}

WHat is a cursor and how do I make it scrollable? :)

like image 733
MissioDei Avatar asked Dec 22 '22 08:12

MissioDei


1 Answers

I got this error before and this is the solution:

bool hasRow = DR.Read();
if(hasRow)
 {
    //TODO
 }
like image 123
Akrem Avatar answered May 04 '23 22:05

Akrem