?
Solved

How to merge two dataset in a single DataGrid to show rows from bouth datasets.....

Posted on 2008-10-28
2
Medium Priority
?
556 Views
Last Modified: 2013-12-17
Hi

I want to merge two datasets into one single grid, and show rows from bouth datasets in the grid.....
now when run my app nothin will appear in the grid..i have done someting wrong here, can somone guide me here...?!

thanks...
private void Reset()
        {
            
            gridImports.AutoGenerateColumns = false;
            DataSet myDsFilesToUndo = AmEngine.Instance.GetUnreconciledImpFiles(myOperator);
            DataSet importedReconsiledfiles = AmEngine.Instance.GetReconciledImpFiles(myOperator);
 
            gridImports.DataSource = myDsFilesToUndo.Tables[0];
            gridImports.DataSource = importedReconsiledfiles.Tables[0];
 
            int test = myDsFilesToUndo.Tables[0].Rows.Count;
            int test1 = importedReconsiledfiles.Tables[0].Rows.Count;
 
            myDsFilesToUndo.Merge(importedReconsiledfiles);
            //**********
            //dataSet1.Merge(dataSet2, False, MissingSchemaAction.Add);
            gridImports.DataSource = myDsFilesToUndo;
       
            //***********
 
            myDsFilesToUndo.Tables[0].Columns.Add(new DataColumn("ClientCount", typeof(int)));
            myDsFilesToUndo.AcceptChanges();
 
            if (myDsFilesToUndo.Tables[0].Rows.Count > 0)
            {
                btnUndoImport.Enabled = true;
                foreach (DataRow idxRow in myDsFilesToUndo.Tables[0].Rows)
                {
 
                    int fileId = (int)idxRow["ImpFile_ID"];
                    int clientCount = AmEngine.Instance.GetClientCountForImpfile(fileId.ToString());
                    idxRow["ClientCount"] = clientCount;
                }
            }
            else
            {
                btnUndoImport.Enabled = false;
            }
           
        }

Open in new window

0
Comment
Question by:Adnan
[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 8

Accepted Solution

by:
dampsey earned 2000 total points
ID: 22820642
           DataSet dataset1 = new DataSet();
            DataSet dataset2 = new DataSet();
            dataset1.Merge(dataset2);
            GridView1.DataSource = dataset1.Tables[0];
0
 

Author Closing Comment

by:Adnan
ID: 31510687
NICE ;) Thanks dampsey
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

If you haven’t already, I encourage you to read the first article (http://www.experts-exchange.com/articles/18680/An-Introduction-to-R-Programming-and-R-Studio.html) in my series to gain a basic foundation of R and R Studio.  You will also find the …
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
Suggested Courses

764 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