none
Problem with DataTable.Select method to select strings with trailing space RRS feed

  • Question


  • Hi all,

    I have encountered a weird behavior using the DataTable Select method. The select filter expression is as follows (with trailing space):

    Name LIKE '*test *' OR Number LIKE '*test *'


    Which translates to search for rows, where "Name" column containing the string "test " (with trailing space) or "Number" column containing the string "test " (with trailing space).

    The DataTable has multiple entries such as "just a test ", "another test ", "test ".
    But, the Select method returns empty data row result.

     

    But when i change the select filter expression to the following (without spaces)

    Name LIKE '*test*' OR Number LIKE '*test*'


    The method returns the correct datarow result with all the entries "just a test ", "another test " and "test ".

     

    Anyone encountered this problem before? Or is this a bug in ASP.NET?

    A previous discussion on this problem appears to be a bug in ASP.NET 1.0
    http://www.themssforum.com/Ado/DataTableSelect-Method-129812/

    Hope we can find a solution. Thanks in advance,

    Heung.

    Thursday, July 3, 2008 8:13 AM