我正在尝试在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
这是返回错误:Laoperaciónaritméticadha provocado un desbordamiento。
谢谢!