Use variable in select

I would like to use a variable to retrieve only the information I need from the information stored in the data table. What should I do?
I’ll search by today’s date.

like this

dt_date.Select("[XXXXXX]=’"+Today+"’")

1 Like

dt_date.select("[Column_Name]=’"+Today+"’")

Hi @Bobae_Lee

I notice you are using a linq expression to select data based on the current date.

It shouild be as simple as just using the Date property in DateTime :

Number → dt_date.Select(function(r) r.Item(“ColumnName”).ToString().Equals(Today))

If your column contains datetime type, make sure to add a formatting that matches with your Today format
Today → DateTime.Now.ToString(“yyyy-MM-dd”)
Number → dt_date.Select(function(r) r.Item(“ColumnName”).ToString(“yyyy-MM-dd”).Equals(Today))

Bests,
Andres

I got a this error

image

Hi @Bobae_Lee

Change variable type (number ) from String to array of datarow (system.data.datarow)