Datatable check

Hi all,
how can i check if there is at least one row in a datatable with column ID = Myvariable?

For example:
ID First name Last name
1 Alex Uang
2 Mike Rover
And MyVariable is 1 so return True

Use below code in if condition,
Datatable.Rows.Count > 0

1 Like

Thanks @Manish540 but i need to check if in id column table there is the value contained in myVariable

Then pass your datatable to for each row, then inside the for each put a if condition like this,
As below screenshot, @andreus91


@andreus91 You can also use this Linq Query inside if Condition :


Thanks a lot! @Manish540 @supermanPunch

The solution in my case is to implement the Linq Query inside if condition.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.