Solved

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

Posted on 2008-10-28
2
548 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
2 Comments
 
LVL 8

Accepted Solution

by:
dampsey earned 500 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

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…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

770 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