473,385 Members | 2,243 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Filtering Dataview [Strange Problem]

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 '*Bel1*'"
I also tried the EncodedColumnName which replaces spaces with _x0020_
like:
DataViewAddress.RowFilter = "Postal_x0020_ Address LIKE '*Bel1*'" 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

Aug 8 '06 #1
3 2968
Got the Answer :)
It should be used as
DataViewAddress.RowFilter = "[Postal Address] LIKE '*Bel1*'"

It wasnt really that strange :)

Anup Daware wrote:
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 '*Bel1*'"
I also tried the EncodedColumnName which replaces spaces with _x0020_
like:
DataViewAddress.RowFilter = "Postal_x0020_ Address LIKE '*Bel1*'" 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
Aug 8 '06 #2
And it only took you five minutes to work it out and then post back to the
newsgroup. Just goes to show that simply writing out your problem and
reading it back to yourself can be quite helpfull in jump starting your brain
;-)

"Anup Daware" wrote:
Got the Answer :)
It should be used as
DataViewAddress.RowFilter = "[Postal Address] LIKE '*Bel1*'"

It wasnt really that strange :)

Anup Daware wrote:
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 '*Bel1*'"
I also tried the EncodedColumnName which replaces spaces with _x0020_
like:
DataViewAddress.RowFilter = "Postal_x0020_ Address LIKE '*Bel1*'" 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

Aug 8 '06 #3
Thanks for sharing as well - it helps others along the way!

dg
"Anup Daware" <an*********@gmail.comwrote in message
news:11**********************@75g2000cwc.googlegro ups.com...
Got the Answer :)
It should be used as
DataViewAddress.RowFilter = "[Postal Address] LIKE '*Bel1*'"

It wasnt really that strange :)

Anup Daware wrote:
>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 '*Bel1*'"
I also tried the EncodedColumnName which replaces spaces with _x0020_
like:
DataViewAddress.RowFilter = "Postal_x0020_ Address LIKE '*Bel1*'" 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

Aug 17 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Alex Ayzin | last post by:
Hi, I have a problem that might be easy to solve(possibly, I've just overlooked an easy solution). Here we go: I have a dataset with 2 datatables in it. Now, I need to do the following: if...
0
by: Patrick | last post by:
I'm working on a contact management application, and need a hand with one aspect... Here's what I want to create: ------------------------------------ A form split into two parts. There is a...
1
by: Webgour | last post by:
I'm tring to filter a dataview with multiple rowfilters. The problem is that each time I use RowFilter on the DataView i'm quering the full dataview as it was loaded, not the filtered version. Is...
6
by: Ubi | last post by:
hi i have a problem with System.Data.DataViewRowState. i have a ReadOnly datagrid, a dataView and a dataTable. i'm using the dataView's filter property to filter the data (firstName =...
1
by: Jason | last post by:
I've gathered a bunch of data from Active Directory and placed it into a datatable ("ADTable"). I now need to sort and filter this table based on the selection of a drop down list("ddlCategory"). ...
7
by: | last post by:
Hello, Does anyone have an idea on how I can filter the data in the gridview control that was returned by an sql query? I have a gridview that works fine when I populate it with data. Now I...
5
by: LDD | last post by:
Hi Folks I'm trying to determine a way to handle paging, filtering and sorting in a datagrid. If I choose to filter and sort, I'd like to return a subset. If that resultset has more records...
2
by: Anup Daware | last post by:
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...
3
by: Harry Haller | last post by:
Hello, I want to implement a generic list which will be used to display 7 columns in a GridView. One should be able to sort, filter and page each of the 7 columns. Ideally the filter should be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.