• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 350
  • Last Modified:

VB.net Filter Syntax


To set a LIKE filter on a DataTable for column [Payment Type] do I use the following syntax

ds.Tables("MyTable").DefaultView.RowFilter = "(Payment Type LIKE '*x*' OR Payment Type LIKE '*x*')"

OR do I use:

ds.Tables("MyTable").DefaultView.RowFilter = "([Payment Type] LIKE '*x*' OR [Payment Type] LIKE '*x*')"
Murray Brown
Murray Brown
1 Solution
RowFilter does not like [ ] so try without those. Also, use '%x%' instead of '*x*'.

ds.Tables("MyTable").DefaultView.RowFilter = "Payment Type LIKE '%x%' OR Payment Type LIKE '%x%'"

But you may have issues on that column name.
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Thanks. I got errors saying with square brackets so thanks for the validation
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now