Perform a LIKE filter on DataView Integer column?

C

Chris Botha

Don't know if this can be done, but if I have a DataTable/DataView that has
an integer column.
Is there a way to do a "LIKE '123%'" kind of a filter on the column, which
obviously works for text a text column.

Thanks.
 
C

Chris Botha

Hi Brad, thanks, but no, I want to set the RowFilter property of the
DataView. I gave your idea a shot, but "CAST" is not valid in the RowFilter
:-(

Thanks in any case.
 
J

Jay B. Harlow [MVP - Outlook]

Chris,
| DataView. I gave your idea a shot, but "CAST" is not valid in the
RowFilter
"CAST" is not valid, however CONVERT should be valid.

http://msdn2.microsoft.com/en-us/library/system.data.datacolumn.expression(VS.80).aspx

I haven't tried it, but something like:

Dim filter As String = "convert(id, 'System.String') like '123%'"

--
Hope this helps
Jay [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net


| Hi Brad, thanks, but no, I want to set the RowFilter property of the
| DataView. I gave your idea a shot, but "CAST" is not valid in the
RowFilter
| :-(
|
| Thanks in any case.
|
|
| | > Is this what you are looking for?
| >
| > where cast(id as varchar) like 123%'
| > --
| > Brad
| >
| > "Software is like melted pudding..."
| >
| >
| > "Chris Botha" wrote:
| >
| >> Don't know if this can be done, but if I have a DataTable/DataView that
| >> has
| >> an integer column.
| >> Is there a way to do a "LIKE '123%'" kind of a filter on the column,
| >> which
| >> obviously works for text a text column.
| >>
| >> Thanks.
| >>
| >>
| >>
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top