Solved

finding distinct count of records in my dataset

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

706 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now