Bryan’s Ruminations

Where I think hard, try to be fair, and sometimes get carried away.
Home Blog Books Podcasts Uses About Contact
Home Blog Books Podcasts Uses About Contact
Home Blog Archives 2003 August August 14

Posts from August 14, 2003

Single-Character Wildcard And ADO.NET

Posted on

Why isn't there a single-character wildcard for use in ADO.NET's Expression property?

I came across this recently when I needed to filter a DataView (using the RowFilter property of the DataView) so that only records containing Value LIKE '2__' (underscore is single-character wildcard in T-SQL). This way I get 200, 201, 202, 203,..., 299, but not 2000, etc.

After a thorough review of the MS docs and my ADO.NET book from Wrox (which incorrectly states that * is for single character wildcards), I decided to just use the LEN() function available in Expressions and limit my results to LEN(Value) = 3 (based on example above).

Then end result is something like this:

MyDataView.RowFilter = "Element='Topic' AND Value LIKE '" & Chapter & "%' AND LEN(Value) = " & TopicNumberLength

Sure would have been nicer to just have a single-character wildcard.

August 12, 2003 August 15, 2003
Archives
2026 2 2025 3 2024 1 2020 2 2019 3 2018 2 2017 2 2016 5 2014 2 2011 4 2010 22 2009 27 2008 124 2007 23 2006 15 2005 22 2004 32 2003 97 2002 92 2001 68 2000 34
© 2026 - Bryan Daneman - RSS
Home About Uses
Archives Books Podcasts Contact
Bluesky Mastodon LinkedIn Github Strava