Bug #10103 Run-time error -2147217887 (VB6) when reading DECIMAL column from mySQL 5.0.4
Submitted: 22 Apr 2005 19:40 Modified: 24 Apr 2005 18:34
Reporter: Luis A S Junior Camargo Email Updates:
Status: Can't repeat Impact on me:
None 
Category:Connector / ODBC Severity:S1 (Critical)
Version:3.51.11-1 OS:Windows (Windows 2000 Server)
Assigned to: CPU Architecture:Any

[22 Apr 2005 19:40] Luis A S Junior Camargo
Description:
When reading DECIMAL (with 12,2) column from mySQL 5.0.4 i receiving this message error:

Run-Time error -2147217887 (80040e21)
Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.

I use Microsoft Visual Basic 6 SP6 with myODBC 3.51.11-1.

The read and write is fine with the VARCHAR, TEXT and others data types.

I tested and the problem with DECIMAL does not occur with the mySQL 4.0.24.

I use this connection string:
Driver={MySQL ODBC 3.51 Driver};Server=xxx.xxx.xxx.xxx; Port=3306;Database=xxxxxx;UID=xxxx;PWD=xxxx;Option=16427;

How to repeat:
Read any column of data type DECIMAL (12,2 in this case, i not tested with othes)

Example of code:

Dim conn As New ADODB.Connection
Dim strConn As String

strConn = "Driver={MySQL ODBC 3.51 Driver};Server=localhost;Port=3306;Database=xxxx;UID=xxxx;PWD=xxxx;Option=16427"
conn.Open strConn

Dim SQLDB As New ADODB.Recordset
Dim StrDB As String

StrDB = "select name,points from tablename where idcode=10"
SQLDB.Open StrDB, conn

If Not (SQLDB.BOF And SQLDB.EOF) Then
   txtname.text = SQLDB("name")   'fine at this point, name is CHAR
   txtpoints.text = SQLDB("points")  'error at this line, points is DECIMAL
end if

SQLDB.close
set SQLDB=nothing

conexao.close
set conexap=nothing

Suggested fix:
I unknow the specific origin of problem, myODBC, mySQL or others.
[24 Apr 2005 18:34] Jorge del Conde
SQL> select * from odbc;
+-----------+
| a         |
+-----------+
| 100.3333  |
| 100.3320  |
| 10220.3333|
| 10220.2000|
+-----------+
SQLRowCount returns 4
4 rows fetched
SQL>
[25 Apr 2005 11:35] Luis A S Junior Camargo
This is a myODBC Bug, not a mySQL Bug, at my mySQL console the command working fine.

Please retry again with the correct attention at the information "How to repeat".
[12 Apr 2006 20:40] Martin Lopez
I had the same problem and I change the odbc driver 03.51.11 by 03.51.12.
[26 Apr 2006 16:54] Marcelo Rodrigo Wiebbelling
I have same problem/case when i'm using innodb tables with decimal columns.