Link to home
Start Free TrialLog in
Avatar of Adnan
AdnanFlag for Norway

asked on

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

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

ASKER CERTIFIED SOLUTION
Avatar of dampsey
dampsey
Flag of Türkiye image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Adnan

ASKER

NICE ;) Thanks dampsey