Ver Mensaje Individual
  #6 (permalink)  
Antiguo 09/09/2004, 10:04
juanta
 
Fecha de Ingreso: noviembre-2003
Ubicación: Guatemala
Mensajes: 72
Antigüedad: 20 años, 6 meses
Puntos: 0
De acuerdo Una Duda Mas RootK

Gracias por la respuesta que me sirvio de guia, pero soy nuevo en .net que me di cuenta que no era lo mismo un sqlconnection a un odbconnection.
por lo que tengo otro problemita.

Código:
Option Explicit On 

Imports System
Imports System.Windows.Forms
Imports System.Data
Imports System.Data.Odbc
Imports Microsoft.VisualBasic
Public Class Form1
    Inherits System.Windows.Forms.Form

    'Driver={mySQL};Server=data.domain.com;Port=3306;Option=131072;Stmt=;Database=my-database;Uid=username;Pwd=password;
    Private Sub Conex()
        Dim nwindConn As OdbcConnection = New OdbcConnection("Driver={mySQL};Server=localhost;Port=3306;" & _
                                                             "Option=131072;Stmt=;Database=caja;Uid=rot;Pwd=;")

        Dim catCMD As OdbcCommand = New OdbcCommand("SELECT * FROM caja", nwindConn)

        nwindConn.Open()

        Dim myReader As OdbcDataReader = catCMD.ExecuteReader()

        Do While myReader.Read()
            Console.WriteLine(vbTab & "{0}" & vbTab & "{1}", myReader.GetInt32(0), myReader.GetString(1))
        Loop

        myReader.Close()
        nwindConn.Close()

    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Conex()
    End Sub
End Class
y en la linea nwindConn.Open() me da el siguiente error:
Excepción no controlada del tipo 'System.NullReferenceException' en ICash.exe

Información adicional: Referencia a objeto no establecida como instancia de un objeto.


Si puedes ayudarme a solucionar este problemita te estaré muy agradecido