PC Review


Reply
Thread Tools Rate Thread

DataView RowFilter: using distinct

 
 
=?Utf-8?B?cmFuZHkxMjAw?=
Guest
Posts: n/a
 
      26th Apr 2007
I have the following line of code (.NET 2.0):

myDataView.RowFilter = "SELECT DISTINCT CYCLE_DATE";

where CYCLE_DATE is one of my column names. This throws the following
exception:

Syntax error: Missing operand after 'DISTINCT' operator.

Any suggestions on what this is really trying to tell me?

Thanks,
Randy
 
Reply With Quote
 
 
 
 
Alberto Poblacion
Guest
Posts: n/a
 
      26th Apr 2007
"randy1200" <(E-Mail Removed)> wrote in message
newsBF96CFC-541C-4B74-BF90-(E-Mail Removed)...
>I have the following line of code (.NET 2.0):
>
> myDataView.RowFilter = "SELECT DISTINCT CYCLE_DATE";
>


This is wrong. The RowFilter does not take a "Select" statement. It only
takes the part that would go after the "Where" in a "Select" statement, such
as
myDataView.RowFilter = "field1>27 AND field2<45". Since the "distinct" does
not go after the "where", the dataview is not adequate for doing the kind of
filtering that you want.


 
Reply With Quote
 
Isaac Abraham
Guest
Posts: n/a
 
      28th Apr 2007
randy1200 wrote:
> I have the following line of code (.NET 2.0):
>
> myDataView.RowFilter = "SELECT DISTINCT CYCLE_DATE";
>
> where CYCLE_DATE is one of my column names. This throws the following
> exception:
>
> Syntax error: Missing operand after 'DISTINCT' operator.
>
> Any suggestions on what this is really trying to tell me?
>
> Thanks,
> Randy


IIRC, you can't use DISTINCT in a row filter. There's an article on MSDN
on how to get around this in code, I believe.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dataview.Rowfilter help s26f84@gmail.com Microsoft Dot NET Framework Forms 3 18th Oct 2006 02:25 AM
Re: Dataview.Rowfilter help s26f84@gmail.com Microsoft Dot NET Framework Forms 0 18th Oct 2006 02:00 AM
About the RowFilter in DataView . kylin Microsoft ADO .NET 2 22nd Mar 2005 09:00 AM
Distinct Count RowFilter/Select? =?Utf-8?B?RXh0cmVtZSBEYXRhc2V0cw==?= Microsoft ADO .NET 1 6th Feb 2005 05:58 PM
select distinct in rowfilter Yoandy Mesa Microsoft ADO .NET 1 8th Jun 2004 02:20 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:24 PM.