Problem with DataView.RowFilter - System.Data.EvaluateException. RRS feed

  • Question

  • When  I type expression

    name LIKE '*$% *'

    I get exception

    “Error in Like operator: the string pattern '*$% *' is invalid.”


    What can I do to avoid this exception?


    Tuesday, June 16, 2009 2:06 PM


  • Hi kicaj

    Have a look at:

    "DataColumn.Expression Property"

    and you'll notice that this expression contains a special charachter that needs to be escaped. The % in your case.

    Change it to, for example;

                DataTable dt = new DataTable();
                dt.Columns.Add(new DataColumn("name", typeof(string)));
                string sql = "name LIKE '*$\\%'";
                DataRow[] rows = dt.Select(sql);



    This posting is provided "AS IS" with no warranties.
    Wednesday, June 17, 2009 7:27 AM