Datagrid, bdd access sous vb.net

cs_Malena Messages postés 5 Date d'inscription mercredi 3 décembre 2003 Statut Membre Dernière intervention 21 janvier 2004 - 31 déc. 2003 à 11:27
djspider2 Messages postés 1 Date d'inscription samedi 29 novembre 2008 Statut Membre Dernière intervention 6 avril 2009 - 6 avril 2009 à 22:38
Salut,
J'ai un soucis au niveau de mon datagrid. J'arrive à le connecté à ma bdd via oledb, mais maintenant je voudrais avoir un champ me permettant de faire une sélection de ligne dans mon datagrid. La sélection devrait se faire au fur et à mesure des lettres encodées dans le champ de sélection.
Quelqu'un saurait quelle(s) méthode(s) utiliser.

Big merci

1 réponse

djspider2 Messages postés 1 Date d'inscription samedi 29 novembre 2008 Statut Membre Dernière intervention 6 avril 2009
6 avril 2009 à 22:38
aiderr moi moi j'ai un base s'apelle    aymenapie
TAble  :EMPLOYE
Le code de bouton recherche:

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

        If ComboBox2.Text = "Matricule" Then
            'If TextBox2.CharacterCasing = CharacterCasing.Upper Then
            ComboBox2.Enabled = False
            TextBox2.Enabled = False

            Dim MyConnexion As New SqlConnection
            MyConnexion.ConnectionString = ("Data Source=SWEET-E8DA0EC49\SQL;" & _
            "Integrated Security=SSPI;Initial Catalog=aymenapie")
            MsgBox("suivnat")
            Dim Mycommand As New SqlCommand("select * from EMPLOYE where MATRICULE='textbox1.text'", MyConnexion)
            MyConnexion.Open()
            Dim myReader As SqlDataReader = Mycommand.ExecuteReader()
            MsgBox("suivnat")
            If (myReader.Read()) Then
                DataGridView2.AllowUserToAddRows() = True
              
                DataGridView2.Rows.Insert(0, myReader)
            Else
                MsgBox("erreur")
            End If
            'End If
        Else
            MsgBox("erreur")
        End If

    End Sub
0
Rejoignez-nous