c# - if statement with datatables -



c# - if statement with datatables -

synopsis :- 2 datatables lists of filenames in first column. using filename in datatable "search" datatable b & update 3rd datatable results.

struggling if statements work foundrows part.

any hints on how can function?

// iterate through leftfiledt, extract filename & search rightfiledt (int = 0; < leftfiledt.rows.count - 1; i++) { // extract leftfilename & store in string variable leftfilematch = leftfiledt.rows[i][0].tostring(); // search rightfiledt leftfilematch string string expression; look = "right_file_name = '" + leftfilematch + "'"; datarow[] foundrows; foundrows = rightfiledt.select(expression); // if no match found if (notfound) { matchedfiledatarow["file_match"] = "false"; matchedfiledatarow["left_file_name"] = leftfilematch; matchedfiledt.rows.add(matchedfiledatarow); } // if match found if (found) { // update matchedfiledt datatable matchedfiledatarow["file_match"] = "true"; matchedfiledatarow["left_file_name"] = leftfilematch; matchedfiledt.rows.add(matchedfiledatarow); } // study progress 'ui' thread comparerworker_left.reportprogress(i);

the select method of datatable returns array of rows match filter criteria. if no rows match array empty.

datarow[] foundrows = rightfiledt.select(expression); if (foundrows.length == 0) { matchedfiledatarow["file_match"] = "false"; } else { matchedfiledatarow["file_match"] = "true"; } matchedfiledatarow["left_file_name"] = leftfilematch; matchedfiledt.rows.add(matchedfiledatarow);

c# winforms if-statement datatable

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -