dadibarca23
Messages postés71Date d'inscriptionmercredi 3 octobre 2012StatutMembreDernière intervention 6 octobre 2019
-
Modifié par NHenry le 8/04/2016 à 20:18
dadibarca23
Messages postés71Date d'inscriptionmercredi 3 octobre 2012StatutMembreDerniè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
cs_JMO
Messages postés1854Date d'inscriptionjeudi 23 mai 2002StatutMembreDernière intervention24 juin 201826 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