Si, y para hacer la conexion uso:
- MySQL Connector ODBC (http://dev.mysql.com/downloads/connector/odbc/5.1.html)
- MySQLDriverCS (http://sourceforge.net/projects/mysqldrivercs/)
Un ejemplo del codigo que uso:
- MySQL Connector ODBC (http://dev.mysql.com/downloads/connector/odbc/5.1.html)
- MySQLDriverCS (http://sourceforge.net/projects/mysqldrivercs/)
Un ejemplo del codigo que uso:
Código [Seleccionar]
'Imports
Imports System.Data
Imports System.Data.Odbc
Imports System
Imports System.IO
'Definimos los datos de Acceso a la Base da Datos
Public Const DBUser As String = "root"
Public Const DBPass As String = "N0t4r1A2I"
Public Const DBServer As String = "localhost"
Public Const DBName As String = "notaria21"
Public Const DBDSN As String = "MySQL"
Public Const DBPort As String = "3306"
Public Const DBDriver As String = "MySQL ODBC 5.1 Driver"
'Var que contiene la cadena de conexión a la base de datos
Public CnxStr As String = "DRIVER=" & DBDriver & "; SERVER=" & DBServer & ";
DATABASE=" & DBName & "; DSN=" & DBDSN & ";
UID=" & DBUser & "; PWD=" & DBPass & "; PORT=" & DBPort & ""
'Esta funcion ejecuta una consulta y regresa un DataTable
Public Function
ExecuteTable(ByVal Query As String) As DataTable
Dim dtDatos As New DataTable
Dim OdbcCmd As New OdbcCommand
Dim Cnx As New OdbcConnection(CnxStr)
Dim daDatos As New OdbcDataAdapter(OdbcCmd)
OdbcCmd.Connection = Cnx
OdbcCmd.CommandText = Query
Try
daDatos.Fill(dtDatos)
Catch ex As OdbcException
Throw New ArgumentException(ex.Message)
Catch ex As Exception
Throw New ArgumentException(ex.Message)
End Try
Return dtDatos
End Function
'Ahora si, A ejecutar el query
Dim Datos As New DataTable
Dim Query as String
Query = "Select * From usuarios Limit 1"
Datos = ExecuteTable(Query) 'Y manda el Error... pero solo en "esa" PC.