Bug #48003 DataReader Read Error
Submitted: 12 Oct 2009 16:34 Modified: 16 Nov 2009 7:47
Reporter: jon eastwood Email Updates:
Status: Can't repeat Impact on me:
None 
Category:Connector / NET Severity:S1 (Critical)
Version:5.0.26 OS:Microsoft Windows
Assigned to: CPU Architecture:Any
Tags: correct format, MySqlDataReader, ReadColumnValue, string

[12 Oct 2009 16:34] jon eastwood
Description:
Get the following error when looping through a data reader generated recordset.

System.FormatException: Input string was not in a correct format.
   at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
   at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
   at MySql.Data.Types.MySqlInt32.MySql.Data.Types.IMySqlValue.ReadValue(MySqlStream stream, Int64 length, Boolean nullVal)
   at MySql.Data.MySqlClient.NativeDriver.ReadColumnValue(Int32 index, MySqlField field, IMySqlValue valObject)
   at MySql.Data.MySqlClient.MySqlDataReader.Read()

How to repeat:
Using ASP.net(VB)
When looping through a recordset using a Datareader thats calling a stored proceedure with params, It gets half way through the recordset and crashes with the below error:

System.FormatException: Input string was not in a correct format.
   at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
   at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
   at MySql.Data.Types.MySqlInt32.MySql.Data.Types.IMySqlValue.ReadValue(MySqlStream stream, Int64 length, Boolean nullVal)
   at MySql.Data.MySqlClient.NativeDriver.ReadColumnValue(Int32 index, MySqlField field, IMySqlValue valObject)
   at MySql.Data.MySqlClient.MySqlDataReader.Read()

Heres the SP:

SELECT 
Property_ID,
IFNULL(Property_Name,"") AS Property_Name,
IFNULL(Display_Street_YN,0) AS Display_Street_YN,
IFNULL(Street,"") AS Street,
IFNULL(District,"") AS District,
IFNULL(Town,"") AS Town,
IFNULL(County,"") AS County,
Post_Outcode,
Post_Incode,
IFNULL(Picture1,"") AS Picture1,
IFNULL(Picture2,"") AS Picture2,
IFNULL(Picture3,"") AS Picture3,
IFNULL(Picture4,"") AS Picture4,
IFNULL(Floor1,"") AS Floor1,
IFNULL(Floor2,"") AS Floor2,
IFNULL(Floor3,"") AS Floor3,
IFNULL(Floor4,"") AS Floor4,
IFNULL(Hips1,"") AS Hips1,
IFNULL(Hips2,"") AS Hips2,
IFNULL(Hips3,"") AS Hips3,
IFNULL(Hips4,"") AS Hips4,
Property_Code,
Rental_YN,
Property_Age,
IFNULL(Feature1,"") AS Feature1,
IFNULL(Feature2,"") AS Feature2,
IFNULL(Feature3,"") AS Feature3,
IFNULL(Feature4,"") AS Feature4,
IFNULL(Feature5,"") AS Feature5,
IFNULL(Feature6,"") AS Feature6,
IFNULL(Feature7,"") AS Feature7,
IFNULL(Feature8,"") AS Feature8,
IFNULL(Feature9,"") AS Feature9,
IFNULL(Feature10,"") AS Feature10,
(SELECT Decode_Title FROM tbl_decodes WHERE Decode_Id=Central_Heating_YN) AS Central_Heating_YN,
(SELECT Decode_Title FROM tbl_decodes WHERE Decode_Id=Double_Glazing_YN) AS Double_Glazing_YN,
(SELECT Decode_Title FROM tbl_decodes WHERE Decode_Id=Garden_YN) AS Garden_YN,
(SELECT Decode_Title FROM tbl_decodes WHERE Decode_Id=Parking_Type) AS Parking_Type,
(SELECT Decode_RightMove FROM tbl_decodes WHERE Decode_ID=Availability_Code) AS Availability_Code,
(SELECT Decode_RightMove FROM tbl_decodes WHERE Decode_ID=Bedroom_Qty) AS Bedroom_Qty,
IFNULL((SELECT Decode_RightMove FROM tbl_decodes WHERE Decode_ID=Price_Prefix_Code),0) AS Price_Prefix_Code,
(SELECT Decode_RightMove FROM tbl_decodes WHERE Decode_ID=PropertyType) AS PropertyType,
(SELECT Decode_RightMove FROM tbl_decodes WHERE Decode_ID=LeasePeriod) AS LeasePeriod,
(SELECT Decode_RightMove FROM tbl_decodes WHERE Decode_ID=Furnishings) AS Furnishings,
(SELECT Decode_RightMove FROM tbl_decodes WHERE Decode_ID=Price_Type_Code) AS Price_Type_Code,
Price,
IFNULL(FullDetails,"") AS FullDetails,
IFNULL(HipURL,"") AS HipURL,
Supplier_No,
PicturesChanged,
Short_Description AS Short_Description,
Detailed_Description AS Detailed_Description

	FROM tbl_property
	WHERE Supplier_No = parSupplier
	AND Portals='Y'
	ORDER BY Property_Id;

The SP runs fine in  a query window and the data all looks good but for some reason it crashes on some records.
[15 Oct 2009 7:32] Tonci Grgin
Hi Jon and thanks for your report...

Now, where am I supposed to start? Can you please do the following:
  o Try the same in cl client and see if it fails for same rows. If so, open a bug report against server.
  o Attach DDL/DML script I can load into my database and accompanying test case. Be sure to mark where the test case actually fails. If you're concerned about sensitive data, attach everything privately.
[16 Nov 2009 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".