Search code examples
c#rowfilteroperand

rowfilter error: Missing operand after ''%اح%'' operator


I dont know why I have below error:

Missing operand after ''%اح%'' operator.

on

dv.RowFilter = "[customer] LIKE N'%" + value + "%'";

also I changed code to:

dv.RowFilter = "[customer] LIKE N'%" + value.Replace(@"'", "''") + "%'";

but still I have error.

Note: I used alias for column name of table. so "customer" is alias


Solution

  • if type of field is NVARCHAR, you shouldn't use "N" in C# codes.

    dv.RowFilter = "[customer] LIKE '%" + value + "%'";