Home All Groups Group Topic Archive Search About

Perform a LIKE filter on DataView Integer column?

Author
28 Mar 2006 6:02 PM
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.

Author
28 Mar 2006 7:36 PM
Brad Roberts
Is this what you are looking for?

where cast(id as varchar) like 123%'
--
Brad

"Software is like melted pudding..."


Show quoteHide quote
"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.
>
>
>
Author
28 Mar 2006 8:40 PM
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.


Show quoteHide quote
"Brad Roberts" <BradRoberts56noj***@hotmail.com> wrote in message
news:277B6C0D-5576-401C-B4C1-9A9F79AA2637@microsoft.com...
> 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.
>>
>>
>>
Author
29 Mar 2006 4:49 AM
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


Show quoteHide quote
"Chris Botha" <chris_s_both***@hotmail.com> wrote in message
news:%238W%23gfqUGHA.5652@TK2MSFTNGP09.phx.gbl...
| 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.
|
|
| "Brad Roberts" <BradRoberts56noj***@hotmail.com> wrote in message
| news:277B6C0D-5576-401C-B4C1-9A9F79AA2637@microsoft.com...
| > 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.
| >>
| >>
| >>
|
|
Author
29 Mar 2006 5:09 PM
Chris Botha
Hi Jay, works perfectly, thanks a lot !  :-)


Show quoteHide quote
"Jay B. Harlow [MVP - Outlook]" <Jay_Harlow_***@tsbradley.net> wrote in
message news:e$87xwuUGHA.4660@tk2msftngp13.phx.gbl...
> 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
>
>
> "Chris Botha" <chris_s_both***@hotmail.com> wrote in message
> news:%238W%23gfqUGHA.5652@TK2MSFTNGP09.phx.gbl...
> | 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.
> |
> |
> | "Brad Roberts" <BradRoberts56noj***@hotmail.com> wrote in message
> | news:277B6C0D-5576-401C-B4C1-9A9F79AA2637@microsoft.com...
> | > 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.
> | >>
> | >>
> | >>
> |
> |
>
>