Comment afficher un nom après la recherche

Résolu
dadibarca23 Messages postés 67 Date d'inscription mercredi 3 octobre 2012 Statut Membre Dernière intervention 6 octobre 2019 - Modifié par NHenry le 8/04/2016 à 20:18
dadibarca23 Messages postés 67 Date d'inscription mercredi 3 octobre 2012 Statut Membre Dernière intervention 6 octobre 2019 - 9 avril 2016 à 12:41
Bonjour,

SALUT tous
jai le code suivant :

  Dim ConnSTR As String = "provider=Microsoft.Jet.oledb.4.0; Data source = C:\hgfd\nws.mdb;Jet OLEDB:Database Password=**********;"
        Dim Connect As New OleDbConnection(ConnSTR)
        Dim Ds As New DataSet
        Dim sqlds As New OleDbDataAdapter("SELECT [numeropor] FROM T2 WHERE [numeropor] LIKE '%" & Trim$(txtCommand.Text) & "%'", Connect)

        Dim strSelect As String = "SELECT * FROM T2 WHERE numeropor='" & txtCommand.Text & "'"

        sqlds.Fill(Ds, "T2")

        If Ds.Tables("T2").Rows.Count > 0 Then
            MsgBox("le nom existe اً")
            Connect.Close()
        Else

            NEWSAVING()
            clion1.MaskedTextBox1.Text = txtCommand.Text
            clion1.Show()
        End If 


le code et correcte la question :
si le nom existe comment afficher sur une textbox

et merci bien


EDIT : Ajout des balises de code (la coloration syntaxique).
Explications disponibles ici : ICI

Merci d'y penser dans tes prochains messages.

2 réponses

cs_JMO Messages postés 1854 Date d'inscription jeudi 23 mai 2002 Statut Membre Dernière intervention 24 juin 2018 27
9 avril 2016 à 10:47
Bonjour dadibarca23,

Pour commencer, il faudrait ajouter:
Option Strict On
Option Explicit On


Que te renvoie ???
        Dim sqlds As New OleDbDataAdapter(" SELECT * FROM T2 " & _ 
                                          " WHERE [numeropor] LIKE '%" & txtCommand.Text.Trim() & "%'", Connect)
        sqlds.Fill(Ds, "T2")

        If Ds.Tables("T2").Rows.Count = 1 Then
            MessageBox.Show(Ds.Tables("T2").Rows.Count.ToString, "nombre ligne")
            MessageBox.Show(Ds.Tables("T2").Columns.Count.ToString, "nombre colonne")

            MessageBox.Show(Ds.Tables("T2").Rows.Item(0).Item(1).ToString & Environment.NewLine & _
                            Ds.Tables("T2").Rows.Item(0).Item(2).ToString)
            Connect.Close()
        Else


        End If
0
dadibarca23 Messages postés 67 Date d'inscription mercredi 3 octobre 2012 Statut Membre Dernière intervention 6 octobre 2019
9 avril 2016 à 12:41
bonjour cs_JMO

MERCI BIEN AMI
votre solution et magnifique

tchaw
0
Rejoignez-nous