Value does not fall within the expected range

I came across the above error message when I was working with SqlCeResultSets today. I was executing a query and assigning values to a SqlCeResultset to bind the resultset to a combobox. But at runtime, when the resultset was bound to the control, I got the above error.

I could not figure out was causing it. My first take was to assume this was due to the fact that teh resultset was empty. But then that did not make any sense. When I looked into the code, i realized that I have created the resultset as ‘Scrollable’, when I was creating it. Then I changes the resultsetoption to ‘None’. This solved the problem.

I am not sure why Scrollable resultsetoption caused this error in the first place. Any ideas would be most welcome.

I figured it out.

You cannot have a non-scrollable resultset bound to a control. If the resultset is non-scrollable, the ResultSetView property becomes null and hence your data binding does not work.

Actually the issue was somewhere else. I had bound the resultset toa  combobox. And for the combobox, I had a selected index cahgned event handler, which was badly coded without any checks for the value that was selected in the combobox. Once I got that sorted out, the problem was sorted.


  1. Hi, I’m from Brazil. I like the same problem. The problem it’s solved?

  2. Поставте антиспам

  3. Описанное в теме напоминает карму Шрека

  4. Слышал продолжение телепузиков снимают

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: