Error encountered on datatable select

Here is the code

Here is the error encountered
If Remarks has N/A: Cannot perform ‘=’ operation on System.Int32 and System.String.

Filter datatable is not working that’s why im trying this approach

1 Like

Hey @joscares

In the second part of the condition please try converting remarks column value to string,


Hope this helps.


I’m having error on adding that code

here is the code:
dt_Reversal.Select(“[Remarks]=‘#N/A’”).length>0 or dt_Reversal.Select(“[Remarks]=‘-2146826246’”).length>0


FYI, it might be clearer to use LINQ for the type, as the following.

dt_Reversal.AsEnumerable().Count(Function(r) r("Remarks").ToString ="N/A" OrElse r("Remarks").ToString ="-2146826246" )>0


1 Like

It works thank you again yoichi!

Hello, Yoichi I tried this on 500k rows of data and taking a long time to process is there a way to make it faster?


The following might be better. Can you try this?

dt_Reversal.AsEnumerable().Any(Function(r) r("Remarks").ToString ="N/A" OrElse r("Remarks").ToString ="-2146826246" )


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