Got more questions? Find advice on: SQL | XML | Regular Expressions | Windows
in Search
Welcome to AspAdvice Sign in | Join | Help

Filtering Dataview

Last post 12-18-2006, 3:25 PM by carlcamera. 3 replies.
Sort Posts: Previous Next
  •  08-08-2006, 6:46 AM 20374

    Filtering Dataview

    Abstract: I want to filter a dataview with a value where column name have a SPACE.

    Description:-
    I bind a dataview to a datagrid,
    The query which is fetching the results in Dataset is something like this:-

    Select POSTAL_ADDRESS as "Postal Address" from Emp where ....

    Now the column name in Dataview is "Postal Address" which is having a space, with this column name when I am filtering the Dataview like:-

    DataViewAddress.RowFilter =  "Postal Address LIKE '*Bel1*'"

    which throws following exception:-
    System.Data.SyntaxErrorException: Syntax error: Missing operand after 'Address' operator.

    I tried
    DataViewAddress.RowFilter =  "\"Postal Address\" LIKE '*TyreBel1*'"
    I also tried the EncodedColumnName which replaces spaces with _x0020_
    like:
    DataViewAddress.RowFilter =  "Postal_x0020_ Address LIKE '*TyreBel1*'" but nothing worked and got the same exception every time..
     

    I searched the net but I didnt get anything on it...
    Any help will be Very-Much Helpful..

    Thanks and Regards,
    Anup Daware

     


    There is nothing in a caterpillar that tells you that it’s going to be a Butterfly…
  •  08-30-2006, 2:57 PM 22259 in reply to 20374

    Re: Filtering Dataview <Strange Problem>

    I would try

     RowFilter = "'Postal Address' LIKE '*Bel*'"

    [ Double-Quote Single-Quote Postal Address Single-Quote ]

     


    Sincerely,

    Carl
    -----
    vine type - content management with standards in mind - vinetype.com
    -----
  •  09-01-2006, 12:19 AM 22298 in reply to 22259

    Re: Filtering Dataview

    Hello Carl,

    Thanks for your valuable post, I already got another solution for this problem I use [ ] brackets for the column-name and it works,

    But I will certainly try your solution also, as its always better to have options :)

    Thanks,

    Anup Daware 


    There is nothing in a caterpillar that tells you that it’s going to be a Butterfly…
  •  12-18-2006, 3:25 PM 25626 in reply to 22298

    Re: Filtering Dataview <Strange Problem>

    Glad I was able to help!

    Sincerely,

    Carl
    -----
    vine type - content management with standards in mind - vinetype.com
    -----
View as RSS news feed in XML