problème pour lire une base de données grace à un data reader et afficher le resultat dans des textbox
salut,
j'essay de lire une base de données grace à un data reader et afficher le resultat dans des textbox mais je reçoi l'erreur suivante:
Citation:
'System.Data.OleDb.OleDbDataReader.Friend Sub New(connection As System.Data.OleDb.OleDbConnection, command As System.Data.OleDb.OleDbCommand, depth As Integer, commandBehavior As System.Data.CommandBehavior)' is not accessible in this context because it is 'Friend'.
le code est le suivant :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| Imports System.Data.OleDb
Public Class Form1
Dim dar As New OleDb.OleDbDataReader
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim myConnection As OleDbConnection
Dim myCommand As OleDbCommand
Dim str As String
str = "select indice, indice_spec from dossier where num_dossier=" & TextBox1.Text
'declaration
myConnection = New OleDbConnection("Provider=MSDAORA.1;UserID=SYSTEM;password=tarik; database=XE")
'MSDORA is the provider when working with Oracle
Try
myConnection.Open()
myCommand = New OleDbCommand(str, myConnection)
'executing the command and assigning it to connection
dar = myCommand.ExecuteReader()
While dar.Read()
TextBox2.Text = dar.Item("indice")
TextBox3.Text = dar.Item("indice_spec")
End While
dar.Close()
myConnection.Close()
Catch y As Exception
End Try
end sub
end class |
et merçi de votre aide