Bug #12921 The "read" property of the datareader is not returning appropriate boolean.
Submitted: 31 Aug 2005 23:29 Modified: 11 Nov 2005 9:06
Reporter: nabby garcha Email Updates:
Status: No Feedback Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version: OS:Windows (Windows XP)
Assigned to: CPU Architecture:Any

[31 Aug 2005 23:29] nabby garcha
Description:
I am using the following code: 

While ddr.Read()
                downloader = ddr.GetString(1) & "   " & ddr.GetInt16(0) & "<br>"
End While

Where ddr is a datareader, downloader is a string.

In the debug mode I see that the query returns 2 results. It steps through twice, but when it tries to read the datareader the thrid time it throws a 

"Connection must be valid and open" error. 

I would imagine that the "while" clause should take care of this, but that is not working in this case. 

Thanks, 
Nabby

How to repeat:
Connect to the database using the MySqlCommand object ("cmd"), MySqlConnection object. 

Declare a datareader ("dr")

run the query using :

dr = cmd.ExecuteReader()

make sure that the query returns multiple rows. 

The try to read each row using in the datareader using:

While dr.read()
......
End While

After the last row has been read and the program jumps to While dr.read() it will give an error:

"Connection must be valid and Open"

my sql query looks like

"Select count(u.userid),business from downloads d,userlogin u where d.userid = u.userid and d.date>='" & datelower & "' and d.date<= '" & dateupper & "' group by business order by 1 DESC LIMIT 0,2 "

I tried this query in the MySqlManager and the query worked fine. Giving me appropriate results.
[14 Sep 2005 17:10] Reggie Burnett
What version of MySQL and Connector/Net are you using?  Is this on .NET or Mono?  What version?
[11 Oct 2005 9:06] Vasily Kishkin
Could you please say me versions of connector and mysql ? It will be better if you create and attach some simple test case. Thanks
[12 Nov 2005 0:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".