Solved

Group Data in Dataset

Posted on 2014-01-24
2
591 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 250 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 250 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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

I have a large data set and a SSIS package. How can I load this file in multi threading?
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

617 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