0

我正在尝试连接到 VB.Net 2010 中的 MySQL 数据库,这里的问题是在我们更改服务器之前相同的代码可以正常工作。这是代码:

    Private Function Validar_Acceso(ByVal sUsuario As String, ByVal sContrasena As String, ByRef sResultado As String) As Boolean
    Dim bRetorno As Boolean
    Dim query As String = "SELECT * FROM Usuario WHERE usuario LIKE '" & sUsuario & "'"
    Dim MySqlConn As New MySqlConnection("Server=; Uid=; Pwd=; Database=RepMasivos; Port=3306;")

    Try
        MySqlConn.Open() 'HERE IS THE System.OverflowException

        Dim dbCommand As MySqlCommand = MySqlConn.CreateCommand()
        dbCommand.CommandText = query
        Dim dbReader As MySqlDataReader = dbCommand.ExecuteReader()
        If dbReader.Read() Then

            If dbReader("password") = getMD5Hash(sContrasena) Then
                sResultado = dbReader("usuario")
                bRetorno = True
            End If
        End If

    Catch ex As Exception
        sResultado = ex.Message
    Finally
        If MySqlConn IsNot Nothing Then
            MySqlConn.Close()
        End If
    End Try
    Return bRetorno

End Function

这是返回错误:La operación aritmética ha provocado un desbordamiento。

谢谢!

4

0 回答 0