locked
Weird case while using [MySQL ODBC 5.3 Unicode Driver] RRS feed

  • Question

  • User944339287 posted

    Hi guys. the following is my customer_table structure & data:

    CID Username Password Name
    10515 stephen 12345 Happy Stephen

    Everything is working fine until I changed to [MySQL ODBC 5.3 Unicode Driver]

    Returned Result of using 3.51 (working fine)
    10515, Happy Stephen

    Returned Result of using 5.3 (incorrect. CID displayed [0] instead of [10515])
    0, Happy Stephen

    below is my code to validate customer login (stephen, 12345)

        Public Function login(ByVal action As String, ByVal username As String, ByVal password As String) As DataTable
    
            Dim ConnStr As String = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;DATABASE=mydatabase;UID=root;PASSWORD=@993272;Charset=UTF8;OPTION=3;"
            Dim MyConn As New OdbcConnection(ConnStr)
            Dim mydataadapter As OdbcDataAdapter
            Dim mydatatable As DataTable
    
            If action = "login" Then
                Str = "SELECT * FROM customer_table WHERE username=? AND password=? AND status = 'Active'"        
            End If
    
            Try
                mydataadapter = New OdbcDataAdapter(Str, MyConn)
                mydataadapter.SelectCommand.Parameters.AddWithValue("", username)
                mydataadapter.SelectCommand.Parameters.AddWithValue("", password)
                mydatatable = New DataTable
                mydataadapter.Fill(mydatatable)
            Catch ex As Exception
                errormsg = ex.Message
                logfile(Str, errormsg)
            End Try
    
            If Not MyConn Is Nothing Then
                MyConn.Close()
            End If
    
            Return mydatatable
    
        End Function



    Monday, June 8, 2020 4:45 PM

All replies

  • User475983607 posted

    There can be many reasons.  Have you done any research on the driver?  Breaking changes? 

    How are you testing?  Is the code above everything needed to reproduce this issue?  Should we assume CID is an integer?

    Monday, June 8, 2020 6:35 PM
  • User944339287 posted

    Hi. I have go through the following url but no clues for my problem:
    https://downloads.mysql.com/docs/connector-odbc-relnotes-en.a4.pdf

    Yes. Code provided is everything needed to reproduce the issue. CID is an integer (auto increment)

    Tuesday, June 9, 2020 3:09 AM