Bonjour,

Je travaille sur VS2008 à partir d'une BDD Access.

Je souhaite alimenter une TextBox à partir d'un Datareader filtré ainsi: SELECT * FROM MaTable WHERE MonChamp ='MaValeurdeChamp'

Je pense que mon erreur se trouve dans la ligne suivante ( ou "ObjetDataRow("MonChamp")" n'existe pas)

Me.TextBox1.Text = ObjetDataRow("MonChamp")

Voici l'intégral de mon code:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 
'RowNumber correspond à 
 
           MyConnexion = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data source=" & _
            "C:\Program Files\MonProg\MonDossier\" & NomBase)
            Mycommand = MyConnexion.CreateCommand()
 
            Mycommand.CommandText = "SELECT * FROM MaTable WHERE MonChamp ='MaValeurdeChamp'"
 
            Try
                MyConnexion.Open()
            Catch ex As Exception
                MsgBox("impossible d'ouvrir la base : " & NomBase, MsgBoxStyle.Exclamation)
                MsgBox(ex.Message)
                MyConnexion.Close()
            End Try
            MyReader = Mycommand.ExecuteReader(CommandBehavior.CloseConnection)
            Me.TextBox1.Text = ObjetDataRow("MonChamp")
            MyReader.Close()
            MyReader.Dispose()
            MyConnexion.Close()
Si vous pouviez m'aider à trouver la bonne syntaxe.
D'avance merci pour vos réponses

Nverder