Solved

finding distinct count of records in my dataset

Posted on 2010-09-23
5
419 Views
Last Modified: 2012-06-21
I have a dataset
dim objBatchRecords as new dataset

There is a field in there called supplier.

I want a count of the distinct suppliers.

Is there a way of finding this from the dataset and if so how?
0
Comment
Question by:scm0sml
  • 3
  • 2
5 Comments
 
LVL 7

Accepted Solution

by:
klakkas earned 500 total points
ID: 33741839
You can get the distinct Suppliers using these commands:

       dim DistinctColumns(0) as string
       DistinctColumns(0)  = "suppliers"
       Dim DistinctSuppliers As DataTable= objBatchRecords.Tables(0).DefaultView.ToTable(true, DistinctColumns)

0
 

Author Comment

by:scm0sml
ID: 33741869
ok and presumably if i wanted to find two distinct fields ai would just add another field name to the string array....correct?
0
 
LVL 7

Expert Comment

by:klakkas
ID: 33741887
Correct! :-)
0
 

Author Comment

by:scm0sml
ID: 33741889
ok excellent thanks for that!
0
 
LVL 7

Expert Comment

by:klakkas
ID: 33741896
No problem, glad I could help.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question