VB.Net datatable.select 不适用于“like”

问题描述 投票:0回答:1

这让我发疯!

我有一个数据表,让我们称之为

tbl
,我想根据我在其他地方的一些规则来选择行,例如
col_a > 'H00' and col_a < 'HZZ

col_b > '0000000000000' and col_b < 'ZZZZZZZZZZZZZ'

col_b like '%0__'

这给了我这样的表达:

dim expression as string = "( col_a > 'H00' and col_a < 'HZZ ) and ( col_b > '0000000000000' and col_b < 'ZZZZZZZZZZZZZ' ) and col_b like '%0__'" 

前两个工作完美,但是当我引入“like”时返回零行。

Dim foundfaults As DataRow()
foundfaults = baseTable.Select(expression)

如果我只使用

dim expression as string = "( col_a > 'H00' and col_a < 'HZZ ) and ( col_b > '0000000000000' and col_b < 'ZZZZZZZZZZZZZ' ) 
我会选择数据,但如果我包含“like”,则行数为零。

为什么不喜欢“喜欢”?

vb.net datatable
1个回答
0
投票

@jmcilhinne 对问题的评估是正确的。我误解了他的第一篇文章,这对我不利。

Like
不适用于“_”作为通配符。

© www.soinside.com 2019 - 2024. All rights reserved.