Is it possible to increment index of a datarow and how, please?

I tried like this
dtDIUpg.Rows.IndexOf(row1) <= dtDIUpg.Rows.IndexOf(row1)+1

its erring out. please guide.!

The reason 'm doing is, for once the match is found between two dt rows, go to next record.


dtDIUpg.Rows.IndexOf(row1) <= dtDIUpg.Rows.IndexOf(row1+1)

@glory1 Can you show us the error that you get , The Image that you have Shown us is a bit Small :sweat_smile: Also can you tell us what you want to do actually?

1 Like

I had tried that already…
This is the error:

are you comparing complete data row? or a value in particular cell?

1 Like

Muralidhar, Comparing value in a particular cell;

the Requirement -
two dt - dt1, dt2 (huge data) …
match first col of row1 to first col of row2
if match found… assign third col of row2 to third col of row1.
'm using (for each row1, row2…)

the problem is even if the match is found and assigned, its keep looping till the end before processing the next record; as its 30k to 40k records… loop goes never ending.

@glory1 I think you need to perform a Join Datatable Operation, If you are comparingTwo Datatables row Values

yes I’m using join to find the matches, after finding the matched records to assign value 'm using for each… any other method?

Hi @glory1

Check this

Ashwin S

1 Like

Yes Ashwin, it seems relevant… just that for me 'tis confusing to apply for my solution.

@glory1 Can you show us a Sample Input Files and an Output File how you are expecting it to be, In that way we can give you the proper Suggestion :sweat_smile:

've attached a sample sheet, in actual its with more 120 columns and 50k records.Book1.xlsx (9.6 KB)

@glory1 If it’s 50k records, We might need to use Linq Query, Using For Each will take up a Lot of time, I’ll try to find a solution using Linq

Take 3 Variables and assign it as 0

ForEachRow in DataTable
forEach(column in row)




1 Like

take column as int

@glory1 What if there is a row in DT1 which doesn’t match with the row in DT2, How would the Output be in that case?

If not matched, no change n to process next.

oh yeah, but here the count of occurrences are incremented; but i’m asking about incrementing the row index of a dt.

can someone guide me in how to increment rows index please?

@glory1 Can you Check this :
I don’t know if this is what you wanted, also check when UnMatching rows are present, also If you’re using 120 Columns kind of File, it is not so Good to use :sweat_smile: , But you can try (13.6 KB)