-2
Je veux filtrer mon DataGridView à partir de deux zones de texte (prénom (fname
) et le second nom (sname
), mais il obtient FILTRÉ juste basé sur fname
je veux filtrer mon avis DataGrid
Voici mon code:
Try
Dim conn As New OleDbConnection
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + IO.Directory.GetCurrentDirectory + "\Kyc.mdb"
Dim cmdfilter As String = " select ID as الرقم_الوطني,fname as الاسم_الاول,sname as الاسم_الثاني,thname as الاسم_الثالث,finame as الاسم_الرابع from O_name where fname like '%" & fname.Text & "' OR sname like '%" & sname.Text & " ' "
Dim cmdcommand As New OleDbCommand
Dim dataadabtar As New OleDbDataAdapter
Dim table As New DataTable
With cmdcommand
.CommandText = cmdfilter
.Connection = conn
End With
With dataadabtar
.SelectCommand = cmdcommand
.Fill(table)
End With
DataGridView1.DataSource = table
DataGridView1.DataSource = Nothing
For i = 0 To table.Rows.Count - 1
With DataGridView1
.Rows.Add(table.Rows(i)("الرقم_الوطني"), table.Rows(i)("الاسم_الاول"), table.Rows(i)("الاسم_الثاني"), table.Rows(i)("الاسم_الثالث"), table.Rows(i)("الاسم_الرابع"))
End With
Next
Catch ex As Exception
MsgBox(ex.Message.ToString)
End Try
End Sub
rien ne se passe lorsque je tente ce code i ont des lignes de remorquage ont même fname mais différent sname .. quand j'essaye ceci les deux lignes apparaissent dans le résultat mais je veux juste un quand je tape sname –