Quantcast
Channel: Oracle, MySQL, Sybase, Informix and other databases
Viewing all articles
Browse latest Browse all 1350

Weird case while using [MySQL ODBC 5.3 Unicode Driver]

$
0
0

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

CIDUsernamePasswordName
10515stephen12345Happy 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




Viewing all articles
Browse latest Browse all 1350

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>