PC Review


Reply
Thread Tools Rate Thread

Distinct Values from a Datatable

 
 
rbutch@coair.com
Guest
Posts: n/a
 
      31st Jul 2005
guys, Has anyone tried this before?
i have a dataset and rather than doing an addtional trip to the server with a DISTINCT sql query - i'd like to just loop thru the existing dataset in memory.
i assign that dataset (ds) to a datatable, declare a datarow and then use the select property to get the distinct employee id.
i keep getting "Syntax error: Missing operand after 'EmplId' operator." and i've pretty much been out on the web looking for a solution to this.
any help is appreciated. snippet of the code is below.
thanks
rik

Dim oTable As DataTable = ds.Tables(0)
Dim myRow As DataRow
For Each myRow In oTable.Select("DISTINCT EmplId")
cboEmplList2.Items.Add(myRow.Item(0))
Next


**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
 
Reply With Quote
 
 
 
 
W.G. Ryan MVP
Guest
Posts: n/a
 
      31st Jul 2005
http://support.microsoft.com/default...b;en-us;326176
"rik butcher" <(E-Mail Removed)> wrote in message
news:Ok%(E-Mail Removed)...
> guys, Has anyone tried this before?
> i have a dataset and rather than doing an addtional trip to the server
> with a DISTINCT sql query - i'd like to just loop thru the existing
> dataset in memory.
> i assign that dataset (ds) to a datatable, declare a datarow and then use
> the select property to get the distinct employee id.
> i keep getting "Syntax error: Missing operand after 'EmplId' operator."
> and i've pretty much been out on the web looking for a solution to this.
> any help is appreciated. snippet of the code is below.
> thanks
> rik
>
> Dim oTable As DataTable = ds.Tables(0)
> Dim myRow As DataRow
> For Each myRow In oTable.Select("DISTINCT EmplId")
> cboEmplList2.Items.Add(myRow.Item(0))
> Next
>
>
> **********************************************************************
> Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
> Comprehensive, categorised, searchable collection of links to ASP &
> ASP.NET resources...



 
Reply With Quote
 
Cor Ligthert [MVP]
Guest
Posts: n/a
 
      1st Aug 2005
Rik,

See this sample on our website

http://www.windowsformsdatagridhelp....2-1a580eb893b2

I hope this helps,

Cor


 
Reply With Quote
 
rbutch@coair.com
Guest
Posts: n/a
 
      1st Aug 2005
guys, i appreciate the help. this'll definately save a round trip and is extrememly fast since it's already in memory.
thanks again
rik

**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
 
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
using distinct in datatable Patrick.O.Ige Microsoft ASP .NET 1 15th Mar 2006 02:24 PM
Get distinct values from a column in a datatable jvb Microsoft VB .NET 2 30th Jan 2006 08:12 PM
Re: DataTable.Compute or .Select to count distinct values in a column Miha Markic [MVP C#] Microsoft ADO .NET 4 31st Aug 2004 02:51 AM
Distinct from a Datatable? Andy Microsoft ADO .NET 1 28th Jan 2004 02:32 PM
DISTINCT in DataTable MeDhanush Microsoft ADO .NET 1 8th Sep 2003 03:43 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:28 AM.