Unable to cast object of type 'System.Double' to type 'System.String'

@AshwinS2 value = string.Join(",",DT1.AsEnumerable().[Select](Function(s) s.Field(Of String)(“employee_id”)).ToArray)

can anyone help me on this

2 Likes

Hi
i think we need some correction over the expression
string.Join(",",DT1.AsEnumerable().Select(Function(s) s.Field(“employee_id”).ToString).ToArray)

Cheers @Tamilarasanaccet

@Palaniyappan
can please give me what correction needed

1 Like

Hi @Tamilarasanaccet

Try using assign newdt=Dt1.Select("[employee_id]<>’’"). copy Todatatable ()

Try this
Thanks
Ashwin.S

this is what is to be mentioned
string.Join(",",DT1.AsEnumerable().Select(Function(s) s.Field(“employee_id”).ToString).ToArray)

you were almost done
Cheers @Tamilarasanaccet

@Palaniyappan bro i am getting error by using this
string.Join(",",DT1.AsEnumerable().Select(Function(s) s.Field(“employee_id”).ToString).ToArray)

Fine
can i have a screenshot of that error if possible
Cheers @Tamilarasanaccet

1 Like

Fine aah sorry
typo mistake
string.Join(",",DT1.AsEnumerable().Select(Function(s) s(“employee_id”).ToString).ToArray)

no need to mention the field

Cheers @Tamilarasanaccet

1 Like

Sometimes it helps to put the Type into the Statement:
DT1.AsEnumerable().Select(Function(s) s.Field(Of String)(“employee_id”).ToString).ToArray

Sometimes an explicit cast is required, so it can be done like:
DT1.AsEnumerable().Select(Function(s) CType(s.Field(Of Object)(“employee_id”),String)).ToArray

2 Likes

hi bro i am using above concated string in one variable and using tha variable in select method filter condition in assign activity

please find the below condition

DT1.Select("[employee_id] NOT in (value)").CopyToDataTable
but getting error as below
Assign: Cannot find column [value].

sorry for the incovinence i am new to this

1 Like

no worries
it should be like this buddy
DT1.Select("[employee_id] NOT in ‘value’ ").CopyToDatatable()
OR
DT1.Select("[employee_id] <> ‘value’ ").CopyToDatatable()

Cheers @Tamilarasanaccet

Please use the Statement as given by me or @Palaniyappan
DT1.Select is something else as DT1.AsEnumerable().Select

Thats why you get the error

1 Like

bro it showing error like this

1 Like

try with this
DT1.Select("[employee_id] <> ‘value’ ").CopyToDatatable()

Cheers @Tamilarasanaccet

@Palaniyappan hi bro below is my statement

value = string.Join(",",DT1.AsEnumerable().Select(Function(s) s(“employee_id”).ToString).ToArray)
result = DT1.Select("[employee_id] NOT in ‘value’ ").CopyToDataTable

@Palaniyappan bro showing error as below

1 Like

hmmmm…it seems like you haven’t removed the square brackets with [‘value’]
it should be like 'value’

image

Cheers @Tamilarasanaccet

@Palaniyappan no bro i am not given bracket

please refer below code
result = DT1.Select("[employee_id] NOT in ‘value’ ").CopyToDataTable

fine,i wonder why so
kindly try once with this
result = DT1.Select("[employee_id] <> ‘value’ ").CopyToDataTable

@Tamilarasanaccet