INVALID ATTEMPT TO READ WHEN READER IS CLOSED.
Bom dia galera estou fazendo o comando abaixo e ao abrir o sistema esta retornando a seguinte mensagem de erro:
Conexão do Vb.net com Mysql
Conexão do Vb.net com Mysql
Public Function cont(ByVal SQL As String) As MySqlDataReader
Dim MySqlConnection As MySqlConnection
MySqlConnection = New MySqlConnection
MySqlConnection.ConnectionString = [Ô]server=localhost;Port=3306; user id=root; password=sysdba; database=scsv[Ô]
Try
MySqlConnection.Open()
Try
Dim Myadapter As New MySqlDataAdapter
Dim command As New MySqlCommand
command.Connection = MySqlConnection
command.CommandText = SQL
Myadapter.SelectCommand = command
Dim Mydata As MySqlDataReader
Mydata = command.ExecuteReader
Return Mydata
Catch erro As MySqlException
MsgBox([Ô] Conexão aberta com sucesso[Ô])
End Try
MySqlConnection.Close()
Catch erro As MySqlException
MsgBox([Ô]Erro ao conectar com o Banco de dados : [Ô] & erro.Message)
Finally
MySqlConnection.Dispose()
End Try
End Function
Faça seu login para responder