Bug #20127 Unknown SQL type - 65535
Submitted: 29 May 2006 14:33 Modified: 6 Jun 2007 11:57
Reporter: Eric Wong Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / ODBC Severity:S1 (Critical)
Version:5.0.0 OS:Windows (Windows XP Pro)
Assigned to: Jess Balint CPU Architecture:Any
Tags: ADO, ODBC5-RC

[29 May 2006 14:33] Eric Wong
Description:
Table structure with a column named DeptInfo_Remark which is TEXT data type. ASP.NET return with "Unknown SQL type - 65535" error when trying to retrieve value from DeptInfo_Remark.

Code:
--------------------------------------------------------------------------------
       Public Function GetRecord(ByVal strQuery As String) As OdbcDataReader
            Try
                If Open() Then
                    OdbcCmd = New OdbcCommand(strQuery, OdbcConn)
                    OdbcCmd.CommandType = CommandType.Text
                    Return OdbcCmd.ExecuteReader(CommandBehavior.CloseConnection)
                End If
            Catch ex As Exception
                'Method to redirect to error page and register error into log file
                objException.GotoExceptionPage(ex)
                Close()
            End Try
       End Function
--------------------------------------------------------------------------------
Dim drDeptInfo As System.Data.Odbc.OdbcDataReader

drDeptInfo = GetRecord("SELECT * FROM DeptInfo WHERE DeptNo = "something")

txtRemark.Text = drDeptInfo.Item("DeptInfo_Remark").ToString

Please reply me with solution or suggestion ASAP.

Thank you very much!

Eric.

How to repeat:
Code:
--------------------------------------------------------------------------------
       Public Function GetRecord(ByVal strQuery As String) As OdbcDataReader
            Try
                If Open() Then
                    OdbcCmd = New OdbcCommand(strQuery, OdbcConn)
                    OdbcCmd.CommandType = CommandType.Text
                    Return OdbcCmd.ExecuteReader(CommandBehavior.CloseConnection)
                End If
            Catch ex As Exception
                'Method to redirect to error page and register error into log file
                objException.GotoExceptionPage(ex)
                Close()
            End Try
       End Function
--------------------------------------------------------------------------------
Dim drDeptInfo As System.Data.Odbc.OdbcDataReader

drDeptInfo = GetRecord("SELECT * FROM DeptInfo WHERE DeptNo = "something")

txtRemark.Text = drDeptInfo.Item("DeptInfo_Remark").ToString
[29 May 2006 15:17] Eric Wong
Even tried to retrieve TEXT data type value from that particular column only instead of retrieving all column also return same error code.

-------------------------------------------------------------------------------
Public Function GetColumn(ByVal strQuery As String) As String
            Dim objValue As Object

            Try
                Open()
                OdbcCmd = New OdbcCommand
                OdbcCmd.Connection = OdbcConn
                OdbcCmd.CommandText = strQuery
                objValue = OdbcCmd.ExecuteScalar

                If Not objValue Is System.DBNull.Value Then
                    Return objValue
                End If
            Catch ex As Exception
                'Method to redirect to error page and register error into log file
                objException.GotoExceptionPage(ex)
            Finally
                Close()
            End Try
        End Function
-------------------------------------------------------------------------------

strQuery = SELECT DeptInfo_Remark FROM DeptInfo WHERE DeptInfo_ID = 'MER'

Please help as it is very urgent.

Thank you.

Eric
[29 May 2006 18:21] Valeriy Kravchuk
Thank you for a problem report. Please, specify the exact version of Connector/ODBC used.
[29 May 2006 18:27] Eric Wong
I am not sure whether the problem came from ODBC connector, but I suspect so.

Connector version is mysql-connector-odbc-5.0.0-alpha-win32
Database version is mysql-5.0.20a-win32

Perhaps is there any new release that fixed the problem and I am not aware of it?

Thank you.

Eric
[31 May 2006 21:36] Jorge del Conde
I was able to reproduce this under XP64 using ODBC 5.0.0a.  I used a random table with 3 text-fields and 2 binary texts.
[31 May 2006 21:36] Jorge del Conde
This problem doesn't happen using the old 3.51 branch of ODBC
[3 May 2007 0:40] Jess Balint
Fix committed in rev 900. Was internal issue of reading the value wrong. 2007-05-03 and later snapshot builds will fix this issue.
[6 Jun 2007 11:57] MC Brown
A note has been added to the 5.00.12 changelog.