Hi there, my robot writes datarows to a datatable. Now, I would like to add a condition, that it only adds the row if it doesn’t exist already in the table. How can I do this?
@Jizh
Let us take you are having a datatable dta and data row as dr
In if Condition
(From p In dta.Select
Where string.Join(",".p.ItemArray).Equals(string.Join(",",dr.ItemArray))
Select p).Count>0
If the count is greater than zero then the row already exists in the Datatable else the datarow is not present in the datatable.
Regards,
Mahesh
4 Likes
@Jizh
No need, you just replace the entire query in If condition, just rename the datatable variable and datarow variable.
Regards,
Mahesh
It says that p is no member of string.
What am I doing wrong?
Regards,
Robin
1 Like