RowFiltyer with System.Double

Hi,

I'm trying to apply a rowfilter to my dataview and I'm having trouble.

My DataSet is coming from a XML file. The columns are of type System.Double. But when I tried to compare using something like this:

DataView1.RowFilter = "Col1 >" + var1;

I got an error saying:

"Cannot perform '>' operation on System.String and System.Int32"

The definition of the field is like this:

<xs:element name="Col1" type="xs:double" minOccurs="0" />

Also, when I tried using the following:

DataView1.RowFilter = " Col1 >' " + var1 + " ' ";

It works but it's not getting the correct rows. It brings some rows that are not meeting the criteria.

Any ideas

Thanks

jc




Answer this question

RowFiltyer with System.Double

  • mary_l

    hi,

    open your dataset in the designer and select your table , then check your fields types in properties and make sure if they of the same type or your dataset failed to load the schema

    hope this helps



  • imidotnet

    Thanks. I did that already and is the double type.

    Any other options

    Thanks

    jc



  • MSGTSC_Test

    I found out what the problem was.

    When I was doing the RowFilter I was using something like this:

    string var1 = 4;

    Col1 > var1 in other words Col1 > 4

    Since the type was double I had to modify the query for this:

    string var1 = 4;

    Col1 > var1.ToString("0.00"); or Col1 > 4.00

    It seems that the double type needs to compare only double types.

    jc



  • RowFiltyer with System.Double