Lesson 3 - Practice 1. Option strict on disallows implicit conversion of string to integer

Currently I’m doing the practice problem in Lesson 3 on Level 1. i’m facing the error “Option strict on disallows implicit conversion of string to integer” when i’m trying to assign a value from data row to a string variable as below,

Anyone please help me to resolve the above issue

Hi @Balamurugan!

Can you check the Type Argument property of the For Each activity?
It should be of type DataRow, since you are iterating through an array of DataRows. This property indicates the Variable Type of the variable row.

1 Like

Hi, argument type I have selected is Datarow, still I’m getting this error. Not able to upload the code here. Can you provide your email so that mail you the code and you can have a look if possible

Hi
Welcome to uipath community
I hope the variable firstName is created twice in the variable panel where one is of type string and another is of type int32
Is it so…kindly check that once
Because everything looks perfect like
—For each with input datarow array
—type argument is datarow
—assign activity with correct expression converting to string with .tostring as the left side of assign activity is a string variable

As the error denotes like the error is cannot assign a string to integer variable that is to the left side variable (“firstName”) in assign activity
So that variable type should be checked
But the variable panel in the image shows that firstName variable is of type string…so we must have created another same named variable of type int32

Or if we have not created any such duplicate variable then as a tryout remove this assign activity and recreate a new assign activity with same variable in left side and same expression in right side

Cheers @Balamurugan

The error is that in the For Each you’re using TypeArgument as System.Data.DataRow[], instead you should use System.Data.DataRow.

The first one is the type of ClubMembers which you want to iterate through. But each item of that array is from type DataRow.

1 Like