Solved

VB.net Filter Syntax

Posted on 2013-01-17
2
323 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
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

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 …
Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
This video discusses moving either the default database or any database to a new volume.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now