c# - Missing operand after '=' operator -


i have line of code uses dataview view_1 , i'm trying filter datagridview product_name , size using rowfilter. here code:

view_1.rowfilter = "product_name = '" + cboproduct.text + "' , size = " + cbosize.text + ""; 

and when try run application says missing operand after '=' operator. missing operand?

you have missing white-space @ 'and

so replace

'and  

with

' ,  

is size string-column or int-column? if it's string need quotation marks around too:

and size = '" + cbosize.text + "'"; 

or better, use string.format others have commented since insreases readability:

view_1.rowfilter = string.format("product_name = '{0}' , size = '{1}'"             , cboproduct.text             , cbosize.text); 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -