Bug #28113 Incompatible CAST string value in date data type MySQL ODBC 3.51.14 with VB6 ADO
Submitted: 26 Apr 2007 6:04 Modified: 14 Sep 2007 14:41
Reporter: Adnan Jalees Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / ODBC Severity:S2 (Serious)
Version:3.51.14 OS:Windows
Assigned to: CPU Architecture:Any

[26 Apr 2007 6:04] Adnan Jalees
Description:
I am using MySQL 5.0.37 in my database driven application developed in Visual Basic 6 with the MySQL ODBC 3.51.14 Connector. I faced a problem that VB Record set is unable to recognize date typed field.

Before when I was using MySQL 5.0.17 with MySQL ODBC 3.51.12 Connector it was working smoothly. No error raised.. but when I updated my MySQL Database 5.0.17 to 5.0.37 and MySQL 3.51.12 to 3.51.14, it is raising error in following sample query.

Select cast(‘2007-04-26’ as Date) as ColumnName from Table 

My problem is Recordset raise error ‘Type Mismatch’, when I assign recordset field to date typed variable.

‘??????’ is showing in immediate window of VB6 immediate window

Currently I am using Windows 2000 Server with SP4, Crystal Reports 9.0, MySQL 5.0.37 and MySQL ODBC 5.0.14 Connector.

How to repeat:
Select cast(‘2007-04-26’ as Date) as ColumnName from Table
[27 Apr 2007 6:53] Adnan Jalees
When i updated MySQL ODBC Connector from 3.51.12 to 3.51.14 i got the error 'Type Mismatch' in CAST Function converting string datatype value to date datatype value. The error raised from Vb Recordset.

it is CAST function working smoothly with connector 3.51.12 in VB Recordset 

I think there is some issues in connector 3.51.14 with vb recordset
[3 May 2007 6:47] Tonci Grgin
Hi Adnan and thanks for your report.

> I think there is some issues in connector 3.51.14 with vb recordset
Alas, there isn't. This is just another manifestation of Bug#10491... Even though the behavior bothering you was introduced in 3.51.14 for a *good* reason (workaround above mentioned bug) seems we will have to roll back the changes. Please be patient until next release of MyODBC is available.

Much like Bug#27790 this is just another manifestation of Bug#10491.
[13 Sep 2007 23:17] Jim Winstead
This bug needs to get re-verified, with a complete test case. I don't think it is related to the issues that Tonci has pointed out, because CAST(... AS DATE) results in a field that is of the DATE type, which should get handled properly.
[14 Sep 2007 7:52] Tonci Grgin
Thank you for your bug report. This issue has already been fixed in the latest released version of that product, which you can download at

  http://www.mysql.com/downloads/

Explanation: Error does not occur in latest GA (3.51.20) with test case attached.
[14 Sep 2007 7:53] Tonci Grgin
Test case

Attachment: 28113.vbs (application/octet-stream, text), 1.58 KiB.

[14 Sep 2007 14:41] Adnan Jalees
Thanks Buddies! 

I have tried CAST Function with MySQL ODBC Connector 3.51.20 in Visual Basic 6. its working fine.

Thanks again