Send Data to a MySQL Database based on a users input

Hi all,

I am trying to use a users input from the ‘Input Dialog’ activity to the insert the data from that input and add it to a column in my database called ‘Total’.

Database info:
Schema - Results
Table Name - RESULTS
Column Name - Total

I’ve tried looking on YouTube and on this forum as well as other forums but I haven’t managed to find a solution yet. I have also tried the Database activity with the ZIP file you can download however that was also no help.

Thanks for any help in advance.

Have you got the database activities?

You would then use query activity to send and insert query - in the parameters you would assign the total value as the variable called from the input dialog.

Something like ‘Insert Into Table_A (Total) VALUES (@Total)’ … etc

Hi, I have the database activities and in the ‘Execute Non Query’ activity I’ve tried typing this after establishing a connection to the db:

“INSERT INTO Results.RESULTS (item_number, manufacturer_1, manufacturer_item_number_1,quantity)
VALUES('” + partNumber + “‘,’” + manufacturerName + “‘,’” + mfrPN + “‘,’” + QUANTITY + “');”

However it says there is a compiler error - String constants must end with a double quote.

partNumber, manufacturerName etc. are all variables from the users input from the ‘Input Dialog’ boxes

So instead of joining string, you can use parameters

INSERT INTO Results.RESULTS (item_number, manufacturer_1, manufacturer_item_number_1,quantity) VALUES(@partNumber,@manufacturerName,@mfrPN,@Quantity);

In the parameters section in properties, you then assign the @partNumber to the variable partNumber.

@NewToRPA - you can’t have newlines in the string - the line-break before “VALUES” is causing the issue.

3 Likes

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