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

php - Dynamic url re-writing using htaccess -

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -