ERRO CONEXAO MDB

CEREBRO.X 19/04/2007 02:00:27
#212663
to tentando aprender vb.NET e to tendo umas dificuldades com as conexaoes

o que ta errado na conexao na hora de mostrar a info na textbox.

Public Class Form1
Public Con As System.Data.OleDb.OleDbConnection
Public Cmd As System.Data.OleDb.OleDbCommand
Public Drr As System.Data.OleDb.OleDbDataReader
Public Const Caminho As String = "C:\MDBs\Producao.mdb"
Public Const Conexao As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Caminho & ";Jet OLEDB:Database Password=novacacc;"
[c] Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Con = New OleDb.OleDbConnection
Con.ConnectionString = Conexao
Con.Open()
MsgBox(Con.State.ToString())
End Sub


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Cmd = New OleDb.OleDbCommand
Cmd.CommandText = "Select * from Colaboradores"
Cmd.Connection = Con
Drr = Cmd.ExecuteReader
TextBox1.Text = Drr.Item("Nome") 'o erro ta dando nessa linha
Con.Close()
End Sub

End Class

Vale UMMMMM!!!
Tópico encerrado , respostas não são mais permitidas