Unix Technical Forum

query in dataview.rowfilter

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 ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-29-2008, 08:47 AM
vbnetrookie
 
Posts: n/a
Default query in dataview.rowfilter

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-29-2008, 08:47 AM
John Bell
 
Posts: n/a
Default Re: query in dataview.rowfilter

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
>



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-29-2008, 08:50 AM
Erland Sommarskog
 
Posts: n/a
Default Re: query in dataview.rowfilter

[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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 01:52 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com