Bug #7623 Adding MySqlParameter causes error if MySqlDbType is Decimal
Submitted: 3 Jan 2005 10:47 Modified: 26 Feb 2005 4:32
Reporter: Emanuele Scozzafava Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version:1.0.3 OS:Windows (Windows XP Pro)
Assigned to: Reggie Burnett CPU Architecture:Any

[3 Jan 2005 10:47] Emanuele Scozzafava
Description:
When the Parameters collection of MySqlCommand is build programmatically and MySqlDbType is Decimal, methods ExecuteXXX crashes.
I'm using 5.0.1 alpha of MySQL Server

How to repeat:
create this stored procedure:

delimiter $$
create procedure sp_test (p_fld0 decimal(10,3))
begin
  select p_fld0;
end$$
delimiter ;

then run this code:

using (MySqlConnection cn = new MySqlConnection("Data Source=db;Database=db;user id=root;"))
{
  using (MySqlCommand cm = new MySqlCommand("sp_test", cn))
  {
    cm.CommandType = CommandType.StoredProcedure;

    MySqlParameter p = cm.Parameters.Add("p_fld0", MySqlDbType.Decimal);
    p.Precision = 10;
    p.Scale = 3;
    p.Value = 21;

    if(cm.Connection.State == ConnectionState.Closed)
      cm.Connection.Open();

    int id = Convert.ToInt32(Convert.ToInt32(cm.ExecuteScalar()));
    System.Console.WriteLine(id);

  }
}

Suggested fix:
none
[19 Jan 2005 19:34] Jorge del Conde
thanks for the bug report !
[26 Feb 2005 4:32] Reggie Burnett
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html