Solved

VB.net Filter Syntax

Posted on 2013-01-17
2
329 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:murbro
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 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:murbro
ID: 38786256
Thanks. I got errors saying with square brackets so thanks for the validation
0

Featured Post

Technology Partners: 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

Suggested Solutions

Title # Comments Views Activity
Consume a webservice via VB in Visual Studio 2015 3 44
visual studio vb.net windows onkeyup 2 40
Telerik RadEditor Control Save 8 39
Broken .resx file generating errors 18 43
This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

734 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