How to insert data in mysql?

Hi averyone,

Can anyone help me to teach, how to write data in database? i try to use Execute Query activity but I don’t know how to use it to make functionality i try to google it cant find tough.

What I have to do is get the price from the browser and write into the database.

@Sharmilah_Devi have you connect the uipath with your database,if not initially connect it using connect activity and then if you want to insert,update,delete items in database you have to use
execute non query activity where we need to write the query. whereas if we want to get data from database use execute query activity.hope this helps.

1 Like

Hi venkat,

thankq for the fast reply. i already did the connection and all. let me to explain what is my task.

I need to get data from database and type into browser ( Done)
Now the final price from the browser i need to type into the database again ( i dont know how to type back the text into mysql)

this is my workflow
Flowchart.xaml (29.4 KB)

@Sharmilah_Devi seems like you haven’t uploaded the xaml file clearly i’m getting errors,plz upload it fully or in zip file

as you said you already get data from database, as we know we get the output as datatable,the price which you get from the browser store it in a to upload again it into database,use execute non query actvity give the conection name and then in the query give as “INSERT into database name(column name to which you want to insert it) value (give the variable of the price)”

1 Like

You should also ensure you are passing arguments into your SQL statement where it is paramaterised. Such as below:

1 Like

Hi venkat

thankq so much but i dint understand what value should give here

i try to enter the variable name but its not coming, i can see it only after i close the query

Can see the variable only after close the query :

oh sure will do that, thank you so much :slight_smile:

@Sharmilah_Devi as you said once you gave all the details in the browser you will get the price right. Store that price in a variable, and give that variable name in the value place.try this let me know if any thing goes wrong.

@venkatmalla6 i did as you mention but still getting this error :cry:

And this is MySQL.

i want it to write in the price column there so i change it the query to update but still im not able to get the update, please help me in this

I have done the parameters tough

What are you passing here? Is this the correct parameter name? It doesn’t appear in your sql statement. The way you have it set up you are passing the value ‘Total’ to your SQL Parameter ‘Argument1’. I suspect this wrong


Also, check that the string value you are passing is being passed to the same datatype. That is, Price in your target table should also be string, which for a database is probably unlikely. Worth checking.

1 Like

Hi @Sharmilah_Devi

Try assigning the query in a string variable and then pass this variable into the sql command property. As far as the variable is concerned ( in your case the price ), put that variable in the string itself.

For e.g query = “UPDATE Set Price = '”+price.ToString+“’ Where Id =‘1’;”

Here, price is the variable which has the price taken from the browser.
Now pass this query variable of type string into the sql input of execute non query activity.


1 Like

Hi ronan,

Sorry for the late reply.

I try to give my database/ column/ Table names in the name column but it is still showing the same error message. And my Variable type is already in the string. i tried in many scenarios i really don’t know how to fix this

hi Karnik thanks for the time you take to reply to me. I did try to give the query as you give but still face the same issue the issue always show as this:

i even try to do as this also (because my variable is already in a string type)
“UPDATE Set Total = '”+“’ Where Id =‘5’;”

hi, have you found a solution to your problem?

@Sharmilah_Devi Hi, have you found the solution to this? I am having the same issue!