By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,344 Members | 1,139 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,344 IT Pros & Developers. It's quick & easy.

Perform a LIKE filter on DataView Integer column?

P: n/a
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.
Mar 28 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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.

Mar 28 '06 #2

P: n/a
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" <Br*****************@hotmail.com> wrote in message
news:27**********************************@microsof t.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.

Mar 28 '06 #3

P: n/a
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/lib...on(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" <ch*************@hotmail.com> wrote in message
news:%2******************@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" <Br*****************@hotmail.com> wrote in message
| news:27**********************************@microsof t.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.
| >>
| >>
| >>
|
|
Mar 29 '06 #4

P: n/a
Hi Jay, works perfectly, thanks a lot ! :-)
"Jay B. Harlow [MVP - Outlook]" <Ja************@tsbradley.net> wrote in
message news:e$**************@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/lib...on(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" <ch*************@hotmail.com> wrote in message
news:%2******************@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" <Br*****************@hotmail.com> wrote in message
| news:27**********************************@microsof t.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.
| >>
| >>
| >>
|
|

Mar 29 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.