dataview rowfiltering question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Aniket Sule

    #1

    dataview rowfiltering question

    Hi,
    I am trying to put a filter on a dataview. the column has [] in its name, it
    is called - tml.[TYPE_CHAR]
    i tried escaping the column name as per the MSDN help - [tml.[TYPE_CHR\]]
    However i get a compilre error - "unrecognis ed escape sequence"
    Can anyone point out what I'm doing wrong ??

    Thanks
    Aniket

    the code is -
    private const string TML_TYPE_COL = "[tml.[TYPE_CHR\]]";
    string Filter = TML_TYPE_COL + " ='Active' ";
    _dataView.RowFi lter = Filter;




  • Frank Oquendo

    #2
    Re: dataview rowfiltering question

    Aniket Sule wrote:[color=blue]
    > Hi,
    > I am trying to put a filter on a dataview. the column has [] in its
    > name, it is called - tml.[TYPE_CHAR]
    > i tried escaping the column name as per the MSDN help -
    > [tml.[TYPE_CHR\]] However i get a compilre error - "unrecognis ed
    > escape sequence"
    > Can anyone point out what I'm doing wrong ??[/color]

    If you have access to the database, I'd recommend changing the field
    name. Otherwise, have you tried @"tml.[TYPE_CHAR]"?

    --
    There are 10 kinds of people. Those who understand binary and those who
    don't.


    (Pull the pin to reply)


    Comment

    • Aniket Sule

      #3
      Re: dataview rowfiltering question

      I tried using @"tml.[TYPE_CHR]", which throws an error saying "Cannot locate
      column tml.TYPE_CHR". Its getting rid of the [] while trying to look for the
      column for some reason.
      I could access teh underlying dataset column and change the column name if
      none of this works, but i was hoping to avoid that.

      Thanks for the help
      Aniket

      "Frank Oquendo" <frankopin@acad x.com> wrote in message
      news:%23EVQt5Su DHA.4060@TK2MSF TNGP11.phx.gbl. ..[color=blue]
      > Aniket Sule wrote:[color=green]
      > > Hi,
      > > I am trying to put a filter on a dataview. the column has [] in its
      > > name, it is called - tml.[TYPE_CHAR]
      > > i tried escaping the column name as per the MSDN help -
      > > [tml.[TYPE_CHR\]] However i get a compilre error - "unrecognis ed
      > > escape sequence"
      > > Can anyone point out what I'm doing wrong ??[/color]
      >
      > If you have access to the database, I'd recommend changing the field
      > name. Otherwise, have you tried @"tml.[TYPE_CHAR]"?
      >
      > --
      > There are 10 kinds of people. Those who understand binary and those who
      > don't.
      >
      > http://code.acadx.com
      > (Pull the pin to reply)
      >
      >[/color]


      Comment

      • Dmitriy Lapshin [C# / .NET MVP]

        #4
        Re: dataview rowfiltering question

        Hi,

        You can try to trick the system by defining the square brackets by their
        numerical codes in a form of \0xnnnn. You can also try to double the both
        square brackets (that is, [[TYPE_CHR]]). The best advice would be to refer
        to the MSDN docs on the DataColumn.Expr ession property syntax, there's a
        chance such issues are explained there.

        --
        Dmitriy Lapshin [C# / .NET MVP]
        X-Unity Test Studio

        Bring the power of unit testing to VS .NET IDE

        Comment

        Working...