Bug #12784 SqlDataReader.Execute throws an error when invalid parameter is bound
Submitted: 24 Aug 2005 14:06 Modified: 22 Sep 2005 9:05
Reporter: Krzysztof Heim Email Updates:
Status: Can't repeat Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version:1.0.4 OS:Windows (Windows XP SP 1)
Assigned to: CPU Architecture:Any

[24 Aug 2005 14:06] Krzysztof Heim
Description:
I have table with column ID type unsinged int
In my code I query the table with
SELECT id, name FROM table WHERE Id = ?Id
with MySqlCommand

I bing parameter Id using type MySqlDbType.Int32

when I put parameter values like 0, 1 etc everything is working fine.
but when I put value -1 I get an exception: Connection must be valid and open 
when calling MySqlCommand.ExecuteReader

I think this is a bug since value -1 is compatibile with MySqlDbType.Int32 - even if DB column type is unsigned.

How to repeat:
100% repetable with above description

Suggested fix:
Should return no rows or at least give correct error and not close connection.
[25 Aug 2005 10:20] Vasily Kishkin
Sorry. I was not able to reproduce the bug on my test case. What version of mysqld do you use ? I tested on 5.0.11 beta.
[25 Aug 2005 10:48] Krzysztof Heim
my version is: 5.0.10a-beta-nt-max
For me it is 100% reproducible.

Be sure to have table column type (in table definition) set to unsigned.
When I change my table column type to signed everything is ok.
[30 Aug 2005 9:07] Vasily Kishkin
My definition of table:

create table tbl (id int unsigned, name char(40));

I attached my test case. Could you please try to build and run my test case ?
[30 Aug 2005 9:07] Vasily Kishkin
Test case

Attachment: bug12784.zip (application/x-zip-compressed, text), 5.81 KiB.

[30 Aug 2005 10:17] Krzysztof Heim
Your test case is working correctly. But in minwile I have reinstaled mySQL to version 5.0.11 - so I guess it is fixed now. I will continue my tests with this version. If I found anything I will reopen this bug.
Thanks
[22 Sep 2005 9:05] Vasily Kishkin
I wait for your results. Please reopen the bug if you found anything.