Bug #3960 Max(DateType) wrong with ADO recordset
Submitted: 2 Jun 2004 7:33 Modified: 21 Mar 2007 10:26
Reporter: [ name withheld ] Email Updates:
Status: Can't repeat Impact on me:
None 
Category:Connector / ODBC Severity:S3 (Non-critical)
Version:3.51.07 OS:Microsoft Windows (Window 2K)
Assigned to: CPU Architecture:Any

[2 Jun 2004 7:33] [ name withheld ]
Description:
When use query Select max(MyDate) from ..... with ADO recordset, it will give value ???????
In MyODBC 3.51.021, it works. When Iit is upgraded to 3.51.07, it has this bugs.

How to repeat:
Here is My Query
SELECT Salespeople.FullName,Salespeople.SPSerialNumber ,  PunchInOut.PunchINOUT , Max(PunchInOut.TimeINOUT) AS MaxOfTimeINOUT ,active FROM Salespeople LEFT JOIN PunchInOut ON Salespeople.SPSerialNumber = PunchInOut.SerialNumber GROUP BY Salespeople.SPSerialNumber , Salespeople.FullName, PunchInOut.PunchINOUT,active HAVING Active=1  Order by Salespeople.FullName
[21 Mar 2007 10:26] Tonci Grgin
Hi and thanks for your report. We appologize for the delay, somehow this report got neglected...

Please upgrade to MyODBC 3.51.14:
 - MySQL server 5.0.38BK on WinXP Pro SP2 localhost
 - MyODBC 3.51.14GA
 - 400000 records table "dnevnik" with "Datum1" being DATE field in database "solusd". 25000+ rows in table "sysinsertvp" with "TS" being TIMESTAMP field.
 - MS generic ODBC client, ODBCte32.exe

--Test--
	Full Connect(Use Driver)

	Env. Attr. SQL_ATTR_ODBC_VERSION set to SQL_OV_ODBC3

	Successfully connected to DSN 'myodbc1'.
SQLExecDirect:
				In:				hstmt = 0x008B1960, szSqlStr = "use solusd", cbSqlStr = -3
				Return:	SQL_SUCCESS=0
SQLExecDirect:
				In:				hstmt = 0x008B1960, 
										szSqlStr = "SELECT MAX(Datum1) FROM solusd.dnevnik", cbSqlStr = -3
				Return:	SQL_SUCCESS=0

Get Data All:
"MAX(Datum1)"
2066-04-01
1 row fetched from 1 column.

SQLExecDirect:
				In:				hstmt = 0x008B1960, 
										szSqlStr = "SELECT MAX(TS) FROM solusd.sysinsertvp", cbSqlStr = -3
				Return:	SQL_SUCCESS=0

Get Data All:
"MAX(TS)"
2006-08-29 14:54:12
1 row fetched from 1 column.
[3 Apr 2007 9:57] Tonci Grgin
ADO VB test produces correct result too:
    Dim cx As New ADODB.Connection
    Dim rs As New ADODB.Recordset
    cx.ConnectionString = "DSN=myodbc1sd"
    cx.Open()
    rs.Open("SELECT MAX(Datum1) FROM solusd.dnevnik", cx, CursorTypeEnum.adOpenForwardOnly, LockTypeEnum.adLockOptimistic)
    Dim oField As ADODB.Field
    Dim oStr As String
    oStr = ""
    Do Until rs.EOF
        For Each oField In rs.Fields
            oStr = oStr & (oField.Value) & ","
        Next
        MsgBox(oStr)
        oStr = ""
        rs.MoveNext()
    Loop
    rs.Close()
    rs.Open("SELECT MAX(TS) FROM solusd.sysinsertvp", cx, CursorTypeEnum.adOpenForwardOnly, LockTypeEnum.adLockOptimistic)
    oStr = ""
    Do Until rs.EOF
        For Each oField In rs.Fields
            oStr = oStr & (oField.Value) & ","
        Next
        MsgBox(oStr)
        oStr = ""
        rs.MoveNext()
    Loop
    rs.Close()