CommandTimeOut Problem

G

Guest

Hello,
I have a table with about 1 million rows.
I need to scroll them and use sqldatareader for that.
The TimeOut property of command object i use to create
the reader is set to 0. I use MSDE 2000 on my local computer.
The problem is that although my timeout is set to 0 which assumes that it is infinite it still gives me TimeOut exception after retrieving approximately 20000 rows (different each time). The interesting thing is that reader.Read() works fine and returns true, but reader.getvalue(<anyindex>) crashes.
This is obviously a bug because if i set my command's timeout to 65000 it works fine.
Is there any bugfix? Or an explanation to this probelm?
 
W

William \(Bill\) Vaughn

There was an issue IIRC with the CommandTimeout property in the 1.0 version
of the Framework that was fixed in 1.1. However, I would take another
approach. Why not fetch a few thousand rows at a time. There are lots of
scrolling techniques that are a lot more efficient and far less demanding on
the server. In any case, you can set the timeout to a very large number (as
you have done).

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

Yurcus said:
Hello,
I have a table with about 1 million rows.
I need to scroll them and use sqldatareader for that.
The TimeOut property of command object i use to create
the reader is set to 0. I use MSDE 2000 on my local computer.
The problem is that although my timeout is set to 0 which assumes that it
is infinite it still gives me TimeOut exception after retrieving
approximately 20000 rows (different each time). The interesting thing is
that reader.Read() works fine and returns true, but
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top