Error due to spaces

i am using a assign to a DataRow variable.
dtTable2.Select(“Emp Id=”+SelectRows(“ID”).ToString)(0)

this is giving me error , saying “Assign: Syntax error: Missing operand after ‘Id’ operator”

The expression “SelectRows(“ID”).ToString” is giving a number i.e ID , so is this issue because of space ?

Hi @P-A-J

Try this:

Assign Activity:
selectedRows = dtTable2.Select("Emp Id = '" + SelectRows("ID").ToString + "'")

Regards,

@P-A-J

Use this

Assign Activity:
yourvariable= dtTable2.Select(“Emp Id = '” + SelectRows(“ID”).ToString + “'”)

Hi @P-A-J

Try with the below expression

dtTable2.Select("[Emp Id] = " + SelectRows("ID").ToString)(0)

Hope it helps!!

This is where you need to think about the resulting string after the variables are replaced.

dtTable2.Select(“Emp Id=”+SelectRows(“ID”).ToString)(0)

Now take "+SelectRows(“ID”).ToString and replace it with the value "ID " and you get…

dtTable2.Select(“Emp Id=ID ")(0)

The problem should now be obvious.

String values need to be inside single quotes in a where clause.

dtTable2.Select(“Emp Id='ID '")(0)

did’nt work , same issue

You also have to put Emp Id inside brackets.

dtTable2.Select(“[Emp Id]=‘”+SelectRows(“ID”).ToString + "’")(0)

1 Like

Hi @P-A-J

Try this

dtTable2.Select("[Emp Id] = '" + SelectRows("ID").ToString + "'")(0)

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