Posted 17 January 2018, 10:35 pm EST
i have 2 grid (it contained primary key and value )
first one is old one
second one is new one
i just wanna find new data or updated data.
is there a useful functions in Flex grid?.
Forums Home / ComponentOne / WinForms Edition
Posted by: kjy079 on 17 January 2018, 10:35 pm EST
Posted 17 January 2018, 10:35 pm EST
i have 2 grid (it contained primary key and value )
first one is old one
second one is new one
i just wanna find new data or updated data.
is there a useful functions in Flex grid?.
Posted 18 January 2018, 4:19 am EST
Hello,
There is no direct function in FlexGrid to compare the data. However, you can compare the data source of both grids and store the difference in the third table. Please refer the following code:
C1.Win.C1FlexGrid.C1FlexGrid fg = new C1.Win.C1FlexGrid.C1FlexGrid();
C1.Win.C1FlexGrid.C1FlexGrid fg2 = new C1.Win.C1FlexGrid.C1FlexGrid();
fg.DataSource = GetTable();
fg2.DataSource = GetTable1();
DataTable dt1 = fg.DataSource as DataTable;
DataTable dt2 = fg2.DataSource as DataTable;
var matched = from table1 in dt2.AsEnumerable()
join table2 in dt1.AsEnumerable()
on table1.Field<string>("code") equals table2.Field<string>("code")
where (table1.Field<string>("Drug").Equals(table2.Field<string>("Drug")))
select table1;
DataTable result = dt2.AsEnumerable().Except(matched).CopyToDataTable();
Hope it helps.
Thanks,
Mohit