Filter an integer using Like in BindingSoure.Filter or DataView.RowFilter

前端 未结 1 1412
醉酒成梦
醉酒成梦 2021-01-22 08:23

I\'ve Trying to filter a DataView which have multiple columns where some is numerical values. Everything works perfectly when typing in a string but once a numerica

相关标签:
1条回答
  • 2021-01-22 09:28

    Consider these notes:

    • You've put the column name between '' which makes it as a string literal.

    • Use [] around column name if it's a complex name.

    • To compare an integer column with LIKE operator, you should first convert it to string because LIKE is an string operator.

    • Also make sure your column name is Courier # and it's not the caption/header text.

    Example

    dataView.RowFilter = "Convert([Some Column], System.String) LIKE '12%'";
    

    More Information

    To learn more about supported syntax for filter, take a look at DataColumn.Expression.

    0 讨论(0)
提交回复
热议问题