Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 143283
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:04:15+00:00 2026-05-11T08:04:15+00:00

I am writing this in C# using .NET 3.5. I have a System.Data.DataSet object

  • 0

I am writing this in C# using .NET 3.5. I have a System.Data.DataSet object with a single DataTable that uses the following schema:

Id      :  uint AddressA:  string AddressB:  string Bytes   :  uint 

When I run my application, let’s say the DataTable gets filled with the following:

1   192.168.0.1   192.168.0.10   300 2   192.168.0.1   192.168.0.20   400 3   192.168.0.1   192.168.0.30   300 4   10.152.0.13   167.10.2.187    80 

I’d like to be able to query this DataTable where AddressA is unique and the Bytes column is summed together (I’m not sure I’m saying that correctly). In essence, I’d like to get the following result:

1   192.168.0.1   1000 2   10.152.0.13     80 

I ultimately want this result in a DataTable that can be bound to a DataGrid, and I need to update/regenerate this result every 5 seconds or so.

How do I do this? DataTable.Select() method? If so, what does the query look like? Is there an alternate/better way to achieve my goal?

EDIT: I do not have a database. I’m simply using an in-memory DataSet to store the data, so a pure SQL solution won’t work here. I’m trying to figure out how to do it within the DataSet itself.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T08:04:16+00:00Added an answer on May 11, 2026 at 8:04 am

    For readability (and because I love it) I would try to use LINQ:

    var aggregatedAddresses = from DataRow row in dt.Rows group row by row['AddressA'] into g select new {     Address = g.Key,     Byte = g.Sum(row => (uint)row['Bytes']) };  int i = 1; foreach(var row in aggregatedAddresses) {     result.Rows.Add(i++, row.Address, row.Byte); } 

    If a performace issue is discovered with the LINQ solution I would go with a manual solution summing up the rows in a loop over the original table and inserting them into the result table.

    You can also bind the aggregatedAddresses directly to the grid instead of putting it into a DataTable.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 93k
  • Answers 93k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You must have generated either menu_item or menuItem or MenuItem.… May 11, 2026 at 6:42 pm
  • Editorial Team
    Editorial Team added an answer Okay, so it was pretty simple after all. I figured… May 11, 2026 at 6:42 pm
  • Editorial Team
    Editorial Team added an answer Assuming you control the contents of your script, you can… May 11, 2026 at 6:42 pm

Related Questions

I am about to start on a journey writing a windows forms application that
I am writing a C# control that wraps DirectX 9 and provides a simplified
I am writing a component that, given a ZIP file, needs to: Unzip the
I am writing a C# client that calls a web service written in Java

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.