Solved

finding distinct count of records in my dataset

Posted on 2010-09-23
5
412 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

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…
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …

831 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