How to filter two columns in bindingsource
-
hi i want to filter base on lastname and firstname encode by the user in textbox1 and texbox2.. but i'm having hard time for the right code for this..heres my code but not functioning.. plz help hows the right way..
bindingSource1.Filter = "LASTNAME like '" + textBox1.Text.Trim() + "%'" AND FIRSTNAME like '" + textBox2.Text.Trim() + "%'"; bindingSource1.Sort = "LASTNAME";
-
hi i want to filter base on lastname and firstname encode by the user in textbox1 and texbox2.. but i'm having hard time for the right code for this..heres my code but not functioning.. plz help hows the right way..
bindingSource1.Filter = "LASTNAME like '" + textBox1.Text.Trim() + "%'" AND FIRSTNAME like '" + textBox2.Text.Trim() + "%'"; bindingSource1.Sort = "LASTNAME";
What is happening? Or not happening that you expect to happen? Obviously, it will depend on the content of textBox1 and textBox2, but I imaging they are pretty simple and you have checked them. Try replacing the textboxes with something you know will match in the DB: "LASTNAME like 'JON%' AND FIRSTNAME like 'MAT%'" with a MATTHEW JONES in the DB.
You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy