Bug #13001 Error in Query in table with datetime field
Submitted: 6 Sep 2005 5:20 Modified: 27 Aug 2007 10:46
Reporter: Ricardo Guevara Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / ODBC Severity:S3 (Non-critical)
Version:3.51.11-2 OS:Windows (windows xp)
Assigned to: CPU Architecture:Any

[6 Sep 2005 5:20] Ricardo Guevara
Description:

Using visual basic 6 and myodbc 3.51.11-2, a database with a table that has a field that is datetime and the value of a row in the datetime filed is '0000-00-00 00:00:00'. I tried to do a query on the table, when i run the same query, it gives an this error -> "Data provider or other service returned an e_fail status -2147467259"

How to repeat:
Create this table:
CREATE TABLE `test2` (
  `dtime` datetime NOT NULL default '0000-00-00 00:00:00',
  `test` int(11) NOT NULL default '0',
  `id` bigint(20) unsigned NOT NULL auto_increment,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

insert this row:
insert into test2(test) values(1);

using visual basic 6, use this code:

    Dim cnstr As String
    
    cnstr = "DRIVER={MySQL ODBC 3.51 Driver};" _
        & "SERVER=localhost;" _
        & "DATABASE=testdatabse;" _
        & "UID=root;" _
        & "PWD=root;" _
        & "OPTION=" & 1 + 2 + 8 + 32 + 2048 + 16384
    
    Dim rst As ADODB.Recordset
    Dim cnx As ADODB.Connection
    
    Set cnx = New ADODB.Connection
    Set rst = New ADODB.Recordset
    
    cnx.ConnectionString = cnstr
    cnx.Open
    
    rst.CursorLocation = adUseClient
    rst.Open "select id from test2", cnx, adOpenStatic
    
    MsgBox rst.RecordCount
    rst.Close
    
    
    rst.CursorLocation = adUseClient
    rst.Open "select * from test2", MCotizacion.conexion, adOpenStatic
    MsgBox rst.RecordCount
    rst.Close

Suggested fix:
i found an workaround by assinging the secord cursorlocation aduseserver
[6 Sep 2005 18:45] Jorge del Conde
Thanks for your bug report.  I was able to reporduce this bug using the attached code under VB 2003
[27 Aug 2007 10:46] 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: 
Hi Ricardo. I am unable to verify this behavior using test case attached using:
 - MySQL server 5.0.48PB on WinXP Pro SP2 localhost
 - MyODBC 3.51.19GA
[27 Aug 2007 10:47] Tonci Grgin
Test case

Attachment: 13001.vbs (application/octet-stream, text), 1.78 KiB.

[27 Aug 2007 10:52] Tonci Grgin
Susanne, this not the same problem as Bug#15681