Attach a variable in a mysql query

Hello all,
I’m trying to attach a variable into a mysql query . I tried concatenating the variable with the query like below.
"select type_of_lender from lendors where email_address = ’ “+ email + " ’ ;” where email is a variable declared in uipath.

There is no error in the syntax but no value from the database is being retrieved.

How can this variable be integrated with the query?

Regards,
Amitha

hey @Amitha

try to use “email.tostring” and for debugging purpose use writeline activity and check what query you are getting.

Regards…!!
aksh

Hi @Amitha,

Is the query working when you directly put the values? Are you getting the desired results too?

If it’s Yes, then go through the below article to for concatenating it :

Regards,
V

Hi @aksh1yadav,

Thanks for responding. I tried using .tostring operator. It isnt working.

Regards,
Amitha

Hi @Vikas.Jain,

I’m getting the results as required when I’m directly querying with the column names.
Thanks for responding.

"select type_of_lender from lendors where email_address = ’ “+ email + " ’ ;”

Here,I have used the same syntax as mentioned in the post you have shared which goes

"

Is there any alternate ?

Hello @Amitha

Please try this and let me know :slight_smile:

“select type_of_lender from lendors where email_address = '”+ email + “’ ;”

Regards…!!
Aksh

1 Like

This worked. Thank you!