I have this line of code which uses a dataview view_1
and I'm trying to filter the datagridview by product_name and its size using the RowFilter
.
Here is the code:
view_1.RowFilter = "product_name = '" + cboProduct.Text + "' AND size = " + cboSize.Text + "";
And when I try to run the application it says Missing operand after '=' operator
.
So what is that missing operand?
I don't know what is wrong I tried to filter first if the text of cboProduct
and cboSize
is empty or if no selection has been made and now it's working. Thank you.
Here is the code
if (cboProduct.Text == string.Empty || cboProduct.SelectedIndex == -1 || cboSize.Text == string.Empty || cboSize.SelectedIndex == -1)
{
view_1.RowFilter = string.Empty;
}
else
{
view_1.RowFilter = "product_name = '" + cboProduct.Text + "' AND size = " + cboSize.Text + "";
}