Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

I'd like my searchbox.text to display not only the LastName but corresponded by FirstName... by using a space or a comma, any of those two.

this is my code

Dim dv As New DataView(dbdataset)
dv.RowFilter = String.Format("LastName Like '%{0}%'", TextBox6.Text)
DataGridView1.DataSource = dv

thanks in advance...
Posted

1 solution

If I understand your question correctly, you can use Or operator. Something like
"LastName Like '%{0}%' Or FirstName Like '%{1}%'"

If you want to embed space to the condition for first and last name consider something like
"LastName Like '% {0}%' Or FirstName Like '%{1} %'"

For information about possible expressions, see https://msdn.microsoft.com/en-us/library/system.data.datacolumn.expression(v=vs.110).aspx[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900