this is my scenatio, now I can track/find out the unique id(column B) by using dt.DefaultView.ToTable(true, “yourColumnName”) this code
but now I want to get this exact output in a datatable and the datatable will be updated with per transaction(here I am considering each unique id as a transaction, e.g 123,456,789)
each time I am getting an unique id I will keep the branch and desg in a datatable and want to write it to a corresponding system.
Uniquedt - datatable containing your unique ids
Dt - original data with all rows
Use a for each row in datatable…on unique datatable you got(uniquedt)
Then inside it use a filter datatable on the original table dt and assign output to filtereddt…and in the condition provide the "ID" on left side and in between use equals and on right side give currentrow("id").ToString
After that in the filtereddt you have your data only for one id
So for each interation you will get new filtered data
@Anil_G thank you this solution is solving my scenario
but can you please mention one more thing, how may I keep the OUTPUT in a datatable instead of writing in separate excel sheet
Like, after getting the first result of 123 in a DT, I will write it in the system and then the database will be cleared and then I will keep doing the same procedure for the rest of the data.
You already have it in filtered datatable…so you can include your database activities inside your for loop and use the filtereddt to populate the data for eqch iteration it repeats the database steps as wel with different set of data