How can I make the name of the column dynamic in the selection? table_excel.Select("[Amount 1]<'0'" ).CopyToDataTable

Hi everyone,
is it possible to make the column dynamic within this instruction?
this is instruction

table_excel.Select ("[Amount 1] <‘0’") .CopyToDataTable

I tried to pass it a string variable in the following way but it doesn’t work.
fieldcheck = “Amount 1”
table_excel.Select ("[fieldcheck] <‘0’") .CopyToDataTable

Do you know if there is a solution to my problem?

@vittoria
Welcome to the Forum

lets assume you have a variable called strColname
give a try on

table_excel.Select ("["+strColname+"] <‘0’") .CopyToDataTable

1 Like

@vittoria - you can try to built the column condition
similar to - strFilter = ‘“+strColumn+”’ “<0”
and pass it to
table_excel.Select(strFilter).CopyToDataTable

1 Like

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