Search code examples
filterdataview

Why is my dataveiw filter crashing


i have a dataview from a data table i am trying to filter to see if there are duplicate values for a manufacture, Type and Serial number but i am getting an error

string strFilter = "Manufacture = " + strMake + " and Type = " + strModel + " and Serial Number = " + strSn;

strfilter = "Manufacture = ford 150 and Type = Raptor and Serial Number = 9999"

dv.RowFilter = strFilter;

this it the error i am getting

An unhandled exception of type 'System.Data.SyntaxErrorException' occurred in System.Data.dll

Additional information: Syntax error: Missing operand after 'Number' operator


Solution

  • You need single quotes for strings.Write serial number in brackets like [Serial number] if that is the name of your column.