RowFilter:Missing operand after '=' operator

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

While using the DataView.RowFilter, if the RowFilter is set to an integer
value, say:

c#
MyValue = 123;
dataview.RowFilter = "MyField = " + MyValue;

vb
MyValue = 123
DV.RowFilter = "MyField = " + MyValue


Any of the preceding code throws a Missing operand after '=' operator error.

What is the deal?
 
Try
dataview.RowFilter = "MyField = " + MyValue.ToString();
which should produce a correct filter string.

Ron Allen
 
Hello Ron,

Thanks but does not work.

DV.RowFilter = "ZipCode = " & ZipCode.Text.ToString is the actual code.

Thanks
 
Hi,

Is ZipCode a numeric or string field?
If later, then you should enclose the value in '', like
DV.RowFilter = "ZipCode = '" & ZipCode.Text.ToString + "'"
 
Thanks,

The field was a string variable text1.text and an integer column value and
it was empty. Thus the Missing operand after =. Always something stupid.

By the way, how did you get to be an MVP?

Miha Markic said:
Hi,

Is ZipCode a numeric or string field?
If later, then you should enclose the value in '', like
DV.RowFilter = "ZipCode = '" & ZipCode.Text.ToString + "'"

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
SLODUG - Slovene Developer Users Group
www.rthand.com

Extreme Datasets said:
Hello Ron,

Thanks but does not work.

DV.RowFilter = "ZipCode = " & ZipCode.Text.ToString is the actual code.

Thanks
 
Back
Top