SALVAR DADOS NO BANCO DE DADOS.
As palavras em vermelho são onde estão os erros.
Erro 1 [ô]MySql.Data.MySqlClient.MySqlDataReader.Friend Sub New(cmd As MySql.Data.MySqlClient.MySqlCommand, statement As MySql.Data.MySqlClient.PreparableStatement, behavior As System.Data.CommandBehavior)[ô] não está acessÃvel neste contexto porque é [ô]Friend[ô].
Erro 2 Fim de instrução esperado.
Erro 3 O nome [ô]strConexao[ô] não está declarado.
Citação:Imports MySql.Data.MySqlClient
Imports System.Data.DataSet
Public Class ConexaoMySql
Private mConexao As New MySqlConnection
Private mComando As New MySqlCommand
Private mDataAdap As New MySqlDataAdapter
Private[txt-color=#e80000] mDataRead[/txt-color] As New MySqlDataReader
Private usuarioServidor As String
Private usuarioBancoDeDaqdos As String
Private usuarioLogin As String
Private usuarioSenha As String
Public Property ServidorUs() As String
Get
Return usuarioServidor
End Get
Set(ByVal value As String)
usuarioServidor = value
End Set
End Property
Public Property BancoDeDadosUs() As String
Get
Return usuarioBancoDeDaqdos
End Get
Set(ByVal value As String)
usuarioBancoDeDaqdos = value
End Set
End Property
Public Property LoginUs() As String
Get
Return usuarioLogin
End Get
Set(ByVal value As String)
usuarioLogin = value
End Set
End Property
Public Property SenhaUs() As String
Get
Return usuarioSenha
End Get
Set(ByVal value As String)
usuarioSenha = value
End Set
End Property
Sub New(ByVal servidor As String, ByVal usuario As String, ByVal senha As String, ByVal bancoDeDados As String)
ServidorUs = ([Ô]localhost[Ô])
LoginUs = ([Ô]Administrador[Ô])
SenhaUs = ([Ô]25041966[Ô])
BancoDeDadosUs = ([Ô]teste_siscom[Ô])
End Sub
Public Sub ConectarMySql()
If Not mConexao.State = ConnectionState.Open Then
Dim strConexao = [Ô]DataSource=[Ô] +ServidorUs+[Ô];User id=[Ô] +LoginUs +[Ô];password=[Ô]+SenhaUs+[Ô];database=[Ô]+BancoDeDadosUs
[txt-color=#0000f0]mConexao = New MySqlConnection()[/txt-color]
mConexao.ConnectionString = [txt-color=#e80000]strConexao[/txt-color]
mConexao.Open()
End If
End Sub
Public Sub DesconectarMysql()
If mConexao.State = ConnectionState.Open Then
mConexao.Close()
mConexao.Dispose()
mConexao = Nothing
End If
End Sub
Public Function ExecutaDataTable(ByVal sql As String) As DataTable
Dim mData As New DataTable
Try
ConectarMySql()
mComando.CommandType = CommandType.Text
mComando.CommandText = sql
mComando.Connection = mConexao
mDataAdap.SelectCommand = mComando
mDataAdap.Fill(mData)
mDataAdap.Dispose()
Return mData
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
Return mData
End Function
Public Function ExecutaDataRead(ByVal sql As String) As MySqlDataReader
mDataRead = Nothing
Try
ConectarMySql()
mComando.CommandType = CommandType.Text
mComando.CommandText = sql
mComando.Connection = mConexao
mDataRead = mComando.ExecuteReader()
mComando.Dispose()
Return mDataRead
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
Return mDataRead
End Function
Public Function ExecutaQuery(ByVal sql As String) As MySqlCommand
Try
ConectarMySql()
mComando.CommandType = CommandType.Text
mComando.CommandText = sql
mComando.Connection = mConexao
Return mComando
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
Return mComando
End Function
End Class
[txt-color=#0000f0]Erro 1 [ô]MySql.Data.MySqlClient.MySqlDataReader.Friend Sub New(cmd As MySql.Data.MySqlClient.MySqlCommand, statement As MySql.Data.MySqlClient.PreparableStatement, behavior As System.Data.CommandBehavior)[ô] não é acessÃvel neste contexto porque é [ô]Friend[ô]. [/txt-color]
Esta é a chave para achar o problema...
Consegue resolver o ultimo erro é muito simples..
Nesta linha:[txt-color=#0000f0] Private mDataRead As New MySqlDataReadar[/txt-color] é só mudar para o seguinte.:
Private mDataRead As MySqlDataReader
E pronto da tudo certo.
Obrigado a todos pela atenção.