DataTable - Extract data between two Int32 values

Dear All

I have a datatable consisted of multiple columns…

TransactionMonth BilledAmount
202210 23.3
202210 10.3
202211 2.6
202211 13.2
202211 24.3
202212 43.65
202212 14.3
202301 22.3
202301 17.3
*Both columns are Int32

Now I need to extract dataset with 202212 >= TransactionMonth >= 202210 only.

*202212 or 202211 are arguments passed from other workflows (so that these are not constantly same. Maybe for the next time, this condition would be 202302 >= TransactionMonth >= 202301.)

Is there any way to get this dataset? LINQ??
Thanks in advance!

Hey

Can you try with this, remember that in the first part (>=) should be located the lowest value and in the second part (<=) the higher value.

(From d In dt
Where (CInt(d("TransactionMonth").ToString.Trim) >= 12345 And CInt(d("TransactionMonth").ToString.Trim)<= 12345)
Select d).CopyToDataTable

Regards!

It worked perfectly as expected, thank you!!

1 Like

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