CONEXAO COM MYSQL
Amigos, como faço para criar uma string de conexão com o mysql?
Wellenns
aqui tem um passo a passo
http://forum.wmonline.com.br/topic/64413-strings-de-conexao/
abraço
aqui tem um passo a passo
http://forum.wmonline.com.br/topic/64413-strings-de-conexao/
abraço
eu uso assim...
[ô]no modulo
Imports System.Data.SqlClient
Imports MySql.Data.MySqlClient
Module ConMysql
#Region [Ô]Minha conexao[Ô]
Public myCON As MySql.Data.MySqlClient.MySqlConnection
Public myCMD As MySql.Data.MySqlClient.MySqlCommand
Public myDRR As MySql.Data.MySqlClient.MySqlDataReader
Public MySQLHost As String = [Ô]host[Ô]
Public MySQLUsuario As String = [Ô]usuario[Ô]
Public MySQLSenha As String = [Ô]senha[Ô]
Public MySQLDataBase As String = [Ô]nomedabase[Ô]
Public Sub ConnectMySQL() [ô]Conecta no MySQL
Try
myCON = New MySql.Data.MySqlClient.MySqlConnection([Ô]server=[Ô] & MySQLHost & [Ô];User id=[Ô] & MySQLUsuario & [Ô];password=[Ô] & MySQLSenha & [Ô];database=[Ô] & MySQLDataBase)
myCON.Open()
Catch ex As Exception
MsgBox([Ô]Erro ao conectar[Ô], vbCritical, [Ô]Atenção![Ô])
Exit Sub
End Try
End Sub
Public Sub DisconnectMySQL() [ô]Desconecta do MySQL
Try
myCON.Close()
Catch ex As Exception
End Try
End Sub
#End Region
End Module
[ô]pra chamar no form
e so colocar ConnectMySQL() pra abrir
e DisconnectMySQL() pra fechar
ate +
[ô]no modulo
Imports System.Data.SqlClient
Imports MySql.Data.MySqlClient
Module ConMysql
#Region [Ô]Minha conexao[Ô]
Public myCON As MySql.Data.MySqlClient.MySqlConnection
Public myCMD As MySql.Data.MySqlClient.MySqlCommand
Public myDRR As MySql.Data.MySqlClient.MySqlDataReader
Public MySQLHost As String = [Ô]host[Ô]
Public MySQLUsuario As String = [Ô]usuario[Ô]
Public MySQLSenha As String = [Ô]senha[Ô]
Public MySQLDataBase As String = [Ô]nomedabase[Ô]
Public Sub ConnectMySQL() [ô]Conecta no MySQL
Try
myCON = New MySql.Data.MySqlClient.MySqlConnection([Ô]server=[Ô] & MySQLHost & [Ô];User id=[Ô] & MySQLUsuario & [Ô];password=[Ô] & MySQLSenha & [Ô];database=[Ô] & MySQLDataBase)
myCON.Open()
Catch ex As Exception
MsgBox([Ô]Erro ao conectar[Ô], vbCritical, [Ô]Atenção![Ô])
Exit Sub
End Try
End Sub
Public Sub DisconnectMySQL() [ô]Desconecta do MySQL
Try
myCON.Close()
Catch ex As Exception
End Try
End Sub
#End Region
End Module
[ô]pra chamar no form
e so colocar ConnectMySQL() pra abrir
e DisconnectMySQL() pra fechar
ate +
Tópico encerrado , respostas não são mais permitidas