Note that there are some explanatory texts on larger screens.

plurals
  1. POdivide dataset in to matched and unmatched datatables
    primarykey
    data
    text
    <p>In my project there are two datasets <code>dsNames</code> and <code>dsDetails</code>.</p> <p>I dont know about SQL. Here I am connecting to XML and Textfiles.</p> <p><strong>dtNames</strong></p> <pre><code>EmployeeName EmployeeRole a 2 b 3 c 4 </code></pre> <p><strong>dtDetails</strong></p> <pre><code> Empid EmployeeName EmpCity EmployeeRole 101 a abc 3 //EmpRole not equal to above table EmpRole 102 b abc 3 103 c xyz 4 104 d pqr 5 105 e rst 6 </code></pre> <p>I want to relate these two datasets based on the <code>EmployeeName</code> and <code>EmployeeRole</code> (here comparing to <code>dsNames</code>) and store the result in another DataSet <code>dsMain</code>(table from <code>dsDetails</code>) and then divide the two dataSets in according to comparison like <code>matchedDataTable</code> and <code>unmatchedDataTable</code>.</p> <p>I know this can be done using <a href="https://stackoverflow.com/q/1014906/1577396">DataRelation</a> or <a href="https://stackoverflow.com/q/6007872/1577396">RowFilter</a> but i cant get a thought how to do this because there are two columns to be compared with other datatable two columns which i dont know.(I am beginner in .net)</p> <p>I tried the below code: (<em>not working</em>)</p> <pre><code> foreach (DataRow rwMain in dsNames.Tables[0].Rows) { foreach (DataRow rwSub in dsDetails.Tables[0].Rows) { if (rwMain["EmployeeName"].Equals(rwSub["EmployeeName"])) { if (rwMain["EmployeeRole"].Equals(rwSub["EmployeeRole"])) { // Matched DataTable } else { //Unmatched DataTable } } } } </code></pre> <p>I am doing something wrong in the above code and also it looks me i am not doing it in a right way.</p> <p>Please no linq because i know it but i cant use it in my project.</p> <p>please assist.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload