Assign: Conversion from string "11/08/2022 00:00:00" to type 'Double' is not valid

Dear All,

Possible to get this resolved with expression editor?

Assign: Conversion from string “11/08/2022 00:00:00” to type ‘Double’ is not valid.

Thanks.

HI @Alfred_Gan

Instead of Cdbl(x("Column name").Tostring)

Try with this expression

DateTime.ParseExact(x("Column Name").Tostring,"dd/MM/yyyy hh:mm:ss",System.Globalization.CultureInfo.InvariantCulture).ToString("dd/MM/yyyy hh:mm:ss")

Or

You can try with this also

CDate(x("Column name").Tostring)

Regards
Gokul

Hi @Gokul001

i tried but have error.


OutputData.AsEnumerable.Where(Function(x)Date.FromOADate(CDate(x(“DATE”).ToString) = Now.Date).Select(Function(x)x(“JOB NO”).ToString).ToArray

OutputData.AsEnumerable.Where(Function(x)Date.FromOADate(DateTime.ParseExact(x(“DATE”).Tostring,“dd/MM/yyyy hh:mm:ss”,System.Globalization.CultureInfo.InvariantCulture).ToString(“dd/MM/yyyy hh:mm:ss”) = Now.Date).Select(Function(x)x(“JOB NO”).ToString).ToArray

Either way have error…guess i does it wrongly

Hi @Alfred_Gan

Try like this expression

Dt1.AsEnumerable.Where(Function(x) (CDate(x("DATE").ToString) = Now.Date)).Select(Function(x)x("JOB NO").ToString).ToArray

Regards
Gokul

Alternative expression @Alfred_Gan

Dt1.AsEnumerable.Where(Function(x) (DateTime.ParseExact(x("DATE").Tostring,"dd/MM/yyyy hh:mm:ss",System.Globalization.CultureInfo.InvariantCulture).ToString("dd/MM/yyyy") = DateTime.Now.ToString("dd/MM/yyyy"))).Select(Function(x)x("JOB NO").ToString).ToArray

Regards
Gokul

1 Like

Hi @Gokul001 ,

It works! thank you!

1 Like

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