@Using like operator in data table

Hi Team,

I tried passing the below code to get matching columns starts with 1
Fixed vend is a column name and values as shown below:
Fixed Vend
1008908
1008908
1008908
1003389
1001375
MK-US2
MK-US2
MK-US2
MK-US2

datarow MainTable2=DT1.Select(“[Fixed vend] LIKE ‘1*’”)

it is thowing conversion error as shown below:
Please help on this.

Thanks
Girish

This error will pop up if there is a datatype mismatch. In this case, please check the type of your excel cells. It appears that the type is not text in your case. Please change the column to text and then check, it should work.

OR rather, you can convert the column in the select method itself :slight_smile: ::

datarow MainTable2=DT1.Select(“Convert([Fixed vend],‘System.String’) LIKE ‘1*’”)

Let me know if this works for you.

Can you post your complete select statement? and if possible attach your excel along with xaml. :slight_smile:

DT1.Select(“Convert([Fixed vend],‘System.String’) LIKE ‘1*’”)

Main.xaml (20.1 KB)
InputExcelSheet.xlsx (46.5 KB)

Or, assuming this is what you want, you could use the fact that the numbers are already doubles and go for

DT1.Select("Col >= 1.0 and Col < 2.0")
1 Like

Main.xaml (20.1 KB)
Hey, Please try with the attached xaml. There was some syntax error. It’s working perfectly fine now.
Let me know if it works for you. :slight_smile:

Hi Prakshi,

Thank you.

Regards
Girish

Anytime. :slight_smile:
Please mark it as solution for others’ reference. :slight_smile:

Regards,
Prakshi Tyagi