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

maven fortify plugin : Unable to load build session with ID XXXXX .. See log file for more details -

c# - Primavera WebServices does not return any data -

android - Display emoji panel with genymotion - keyboard/touch input? -