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 Posts Single-Character Wildcard And ADO.NET

Single-Character Wildcard And ADO.NET

by Bryan on in Developer Stuff

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.


Newer Older
Categories
📚 Books 4 🍎 Health and Fitness 172 Companies That Could Do Better 2 Cool Stuff 8 Cutting The Cord 4 Day Job 3 Developer Stuff 56 Eats and Drinks 18 Education 1 Entertainment 6 Family & Friends 26 In General 114 IndieWeb 1 My Weight Loss Journey 3 🗒️Notes To Myself 1 Politics 3 Project 18,253 8 Reviews 6 Security 2 Site Information 24 Sports 68 Technology 27 Travel 2 Weblog Applications 23
© 2026 - Bryan Daneman - RSS
Home About Uses
Archives Books Podcasts Contact
Bluesky Mastodon LinkedIn Github Strava