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

  • SEARCH
  • Home
  • 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 611165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:45:14+00:00 2026-05-13T17:45:14+00:00

Scenario I have a c# winforms application with a gridview. The gridview datasource is

  • 0

Scenario

I have a c# winforms application with a gridview.
The gridview datasource is populated by a dataset.
The contents of this dataset get updated every few seconds, and there are not always the same number of items in the dataset etc.
The dataset actually gets populated (or needs to get populated) by multiple other datasets being passed in one at a time.These datasets update at completely random times that cannot be controlled.

The Issue

Since essentially the GridView dataset is being “CONTINUALLY UPDATED” – At the time of an update(The point that a new dataset with the latest information in it needs to be merged with the existing GridView DataSource), I need to take a copy of the current dataset populating the gridview, compare it to the incoming data from the other dataset and update ONLY the data that is new.

So Far

I’ve tried a series of different methods but I can’t seem to get this to work. I either end up with the dataset just being added to continually with duplicates of slightly different data, or the rows randomly get deleted (I tried using a merge all then delete approach which only works occasionally).

Any ideas how I can get around this!?

At the moment the gridview just updates itself to show the latest incoming dataset without the previous dataset merged into it…..

CODE – This randomly deletes the rows even though it does at some points display all data

//If the existing GridView dataset contains any rows that 
//exist in the incoming latest dataset (matched on the two unique fields
//of the dataset), then remove that row from the existing GridView dataset
for (int i = 0; i < existingPriceResultsDTCopyForCompare.Rows.Count; i++)
{
    foreach (DataRow incomingRow in incomingDS.Tables[0].Rows)
    {
        string incomingDate = incomingRow["Date"].ToString();

        DataRow currentRow = existingPriceResultsDTCopyForCompare.Rows[i];
        if ((currentRow["CCY"].ToString().Contains(incomingCcy))
            && (currentRow["Date"].ToString().Contains(incomingDate)))
        {
            existingPriceResultsDT.Rows.RemoveAt(i);

        }
    }
}

//Then merge the existing GridView dataset (Minus the old data that 
//matches the data from the incoming Dataset with the latest information),
//With the brand new incoming data.
incomingDS.Merge(existingPriceResultsDT);

EDIT –

I’m beginning to wonder if the incoming dataset keeps being overwritten by the next incoming dataset before the iteration has time to complete. So I’m guessing I need to lock the incoming DataSet?

  • 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. Editorial Team
    Editorial Team
    2026-05-13T17:45:14+00:00Added an answer on May 13, 2026 at 5:45 pm

    Have you tried something similar

      DataSet ds1 = new DataSet();
      DataSet ds2 = new DataSet();   
    
      ds1.Merge(ds2);    
      DataSet ds3 = ds1.GetChanges();
    

    As per your Objects

      DataSet existingPriceResultsDT = new DataSet();
      DataSet incomingDS = new DataSet();
    
      incomingDS.Merge(existingPriceResultsDT);
      existingPriceResultsDT = incomingDS.GetChanges();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 453k
  • Answers 453k
  • 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 According to set_time_limit(), this should never be an issue because… May 15, 2026 at 9:28 pm
  • Editorial Team
    Editorial Team added an answer First, I think you neglect the cost of allocating the… May 15, 2026 at 9:28 pm
  • Editorial Team
    Editorial Team added an answer SELECT question_id FROM questions ORDER BY NEWID() gives you all… May 15, 2026 at 9:28 pm

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.