?
Solved

VB.net Filter Syntax

Posted on 2013-01-17
2
Medium Priority
?
349 Views
Last Modified: 2013-01-17
Hi

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*')"
0
Comment
Question by:Murray Brown
2 Comments
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 2000 total points
ID: 38786252
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.
0
 

Author Closing Comment

by:Murray Brown
ID: 38786256
Thanks. I got errors saying with square brackets so thanks for the validation
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Loops Section Overview
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question