Error: Function (x) not found in my Link Query

I am trying to get a particular row from a Datatable based on a value of one of the columns using Link.

myDatatable.AsEnumerable().Where(Function(r) r[0].ToString().Equals(variableName))

Error is: Non-invocable member ‘Function’ cannot be used like a method. The name ‘r’ does not exist in the current context

Hi @ChiefMonk,

you can try the below instead

(from r in myDatatable.select where r(0).tostring=variablename select r).copytodatatable

Hi @ChiefMonk

Try with this expression

DtBuild.AsEnumerable.Where(Function(r) r(0).ToString=variableName).CopyToDataTable

Regards
Gokul

hi @ChiefMonk

Check this once change the “[ ]” to “()” and run your process if throwing error try the belo one

Checkout this

myDatatable.AsEnumerable().Select(Function(r) r(0).ToString().Equals(variableName))

Regards
Sudharsan

Hi @ChiefMonk ,

Maybe you have used c# as programming language, In that case the expression would be converted to the below :

myDatatable.AsEnumerable().Where(r=> r[0].ToString().Equals(variableName))

Let us know if the above suggestions doesn’t work and provide us the error message when used.