Hello everyone,
Consider in below screeshot i want to update all the rows column2 corresponding “text” value in Column1. I want to achieve it without using for each loop and SQL. I have to found few threads in forum now proper solution is given in that. Can someone help on it?
@lakshman Can you help on this?
lakshman
(Ganta lakshman)
June 28, 2019, 1:48pm
3
@Manjuts90
Give me some time and am already trying this one.
lakshman
(Ganta lakshman)
June 28, 2019, 4:45pm
4
@Manjuts90
Sorry. I tried so many ways but not finding required solution. I don’t know how to do this without using For Each loop.
@lakshman Thanks for your time, is it possible to get all indexes of particular element in colulm1 at once?
lakshman
(Ganta lakshman)
June 29, 2019, 3:16am
6
@Manjuts90
I didn’t not get. Could you please show me some sample input and output.
@lakshman In above screenshot,I want to get indexes of “text” data which 0,2,3 as output since text is present in those rows.
If I give input as “Form” I want to get indexes as 1,4.
Like wise if I give input as “Submit” I want to get index as 5.
I have to get this indexes without using for each loop. Can you get me solution for this.
@Manish_Pandey By using add data row we can only new data to datatable. Your answer will not give solution to my question. Anyhow thanks for reply.
lakshman
(Ganta lakshman)
June 29, 2019, 4:26am
10
@Manjuts90
Try this expression:
yourDT.AsEnumerable().Where(Function(row) row(“Column1”).ToString.Equals(“text”)).Select(Function(row) DT.Rows.IndexOf(row)).ToArray()
this will expression will give index of all matching rows and output is array of integer. If you have any doubts then let me know.
@lakshman Thanks for your time, query given by you is working perfectly.