What would cause an OdbcDataReader to hang?
In my C# code I have an ODBC datareader that's the results of a call to a stored procedure with a parameter. W开发者_高级运维hen running the program by the customer, while retrieving the results from the datareader , using a while loop, at some point it will stop by the rdr.Read() command and just stand by for an undefined number of minutes and then continues.
while (rdr.Read()) {Somecode...}
What could cause this behaviour?
at some point it will stop by the rdr.Read() command and just stand by for an undefined number of minutes and then continues.
Because it iwaiting for data. Basically look at the data source and figure out why it hangs.
The reader's contract is "either wait for data or throw an exception". Obviously your data suorce has a long timeout (or none) and data is not flowing in (as you expect).
精彩评论