This is a discussion on query in dataview.rowfilter within the SQL Server forums, part of the Microsoft SQL Server category; --> In the dataview rowfilter property, how can I say that I just want Titles that start with 'A' to ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| In the dataview rowfilter property, how can I say that I just want Titles that start with 'A' to 'J' ?? ex: dv.rowfilter = " Country = ' France ' " I want dv.rowfilter = " Title = (from 'A' to 'J') " This doesn't work : dv.rowfilter = " Title like '[a-j]%' " Neither does : dv.rowfilter = " Title like 'a%'" AND "Title like 'b%'" AND..so on But this does work just for the Titles starting with 'a' dv.rowfilter = " Title like 'a%' " any idea ? JMT |
| |||
| Hi You don't say what the different queries produce and why they are wrong? I would expect dv.rowfilter = " Title like '[a-j]%' " to work unless you have a case sensitive database. dv.rowfilter = " Title like 'a%'" AND "Title like 'b%'" AND..so on will not work as you are using AND instead of OR John "vbnetrookie" <bigjmt@hotmail.com> wrote in message news:1117739689.034013.284370@g44g2000cwa.googlegr oups.com... > In the dataview rowfilter property, how can I say that I just want > Titles that start with 'A' to 'J' ?? > > > ex: > dv.rowfilter = " Country = ' France ' " > > > I want > dv.rowfilter = " Title = (from 'A' to 'J') " > > This doesn't work : > dv.rowfilter = " Title like '[a-j]%' " > > Neither does : > dv.rowfilter = " Title like 'a%'" AND "Title like 'b%'" AND..so on > > But this does work just for the Titles starting with 'a' > dv.rowfilter = " Title like 'a%' " > > any idea ? > JMT > |
| ||||
| [posted and mailed] vbnetrookie (bigjmt@hotmail.com) writes: > In the dataview rowfilter property, how can I say that I just want > Titles that start with 'A' to 'J' ?? > > ex: > dv.rowfilter = " Country = ' France ' " > > I want > dv.rowfilter = " Title = (from 'A' to 'J') " > > This doesn't work : > dv.rowfilter = " Title like '[a-j]%' " > > Neither does : > dv.rowfilter = " Title like 'a%'" AND "Title like 'b%'" AND..so on > > But this does work just for the Titles starting with 'a' > dv.rowfilter = " Title like 'a%' " Assume that this is really SQL passed to SQL Server, my bets goes to: dv.rowfilter = " Title like '[ABCDEFGHIJ]%' " But I believe you are in the wrong newsgroup. It looks to me that you are using a row filter on the DataView object, and they have their own syntax. As I can read out from the book I have on ADO .Net, it does not seem that you can use [] as wildcards in a row filter. In such case you would have to use: dv.rowfilter = " Title like 'a%'" OR "Title like 'b%'" OR..so on To get real certainty, you should frequent microsoft.public.dotnet.framework.adonet. -- Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se Books Online for SQL Server SP3 at http://www.microsoft.com/sql/techinf...2000/books.asp |