Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Group Data in Dataset

Posted on 2014-01-24
2
Medium Priority
?
613 Views
Last Modified: 2014-01-29
I have a dataset that I populate from and SQL Server database and then add a new column to from within my code.  The purpose of that  new column is to store a value that is calculated from within my based on the current date.   I have all of this part of my coding working ok  

What I want to do now is group all of the data by the new column I added so I can use it in a report

Can this be done?  The column I want to group on is not part of the original dataset but the new column I added and the value that was stored in it.

I'm using vb.net, .NET Framework  4.0
0
Comment
Question by:Mike_Stevens
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 83

Assisted Solution

by:CodeCruiser
CodeCruiser earned 1000 total points
ID: 39806920
You can use LINQ to do grouping. Example here

http://sharepoint-tamizha.blogspot.co.uk/2013/08/group-by-multiple-columns-in-datatable.html

You can also loop through the table and do it manually. Example here

http://sutocom.net/2013/09/04/apply-group-by-clause-on-datatable-in-c/
0
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 1000 total points
ID: 39807817
You might be able to define the extra column in the query itself, as a calculated column, and perform the grouping in the query itself. Depending on the operations that you need to do, this is usually faster to do it on the server than do in code.

Then, the result of you query would already be grouped.
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

705 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