Error while converting dictionary to datatable

Hello Team,

I am converting the dictionary to the data table. I am facing an issue while adding the data row.
Syntax for Add data row–>{item.Key,item.Value}
Following is the error I am getting for Add Data Row activity.
not all code paths return a value in lambda expression of type ‘func’

Please help me resolve this issue

Hi,

Can you try as the following?

new object[] {item.Key,item.Value}

Regards,

Thank you. This solution helped me resolve my issue

If your dictionary is myDict and you’re looping through myDict.Keys with item as the value for the For Each (set as datatype string), then your expression for the array property should be…

{item,myDict(item).ToString}

item is a string containing the key name, not the key itself. So item.Value is invalid. It’s myDict(key).ToString to get the value.

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