Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

  • *Experts*
Posted

Try square brackets:

[vb

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

[/code]

 

-ner

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...