Adding data to database using variables

hii guys,i just struck in the middle of the process, my query is initially i scraped data from the eCommerce website and stored it in a datatable which contains 3 columns and used for each loop,in body section i used assign activity to store each row value to three variables say product,url,price. i tried to add each row value to the database it worked but only the variables are added to it not the values

2 Likes

@venkatmalla6

Could you please show me how you assigned values ?

@lakshman


i assigned each row value to the variables product,url,price.and i placed those three variables in the values place i execute non query.

1 Like

@venkatmalla6

Remove that single quotes for those variables and then try once.

@lakshman no its not working saying invalid column names

@venkatmalla6

Try like this:

Values(β€˜β€œ+product+”’,β€˜β€œ+price+”’)

@lakshman

not working

@venkatmalla6

Could you please share your workflow with me. Need to check once.

@lakshman sure folder.zip (21.8 KB) have a look

1 Like

@lakshman thanks for your time buddy,i got the output

1 Like

@venkatmalla6

In your database, What is the data type for product, price and url ? Is it string or not ?

And also product and price variables are Generic variables and change it to string and then try.

@lakshman hii i get the data from my datatable to database but it retrieved some rows and for some rows only variables names pasted

1 Like

@venkatmalla6

Please show me your Execute Query once.

@lakshman

@venkatmalla6

Please follow below steps.

  1. put that Connect activity outside of the loop and make it as first step.

  2. Then read data from Excel file and use For Each Row activity to iterate that data.

      ForEach row in DataTable
        - use Execute Non Query and pass insert query like this:
    

β€œINSERT into product(product,url,price) Values(’ β€œ+row(β€œproduct”).Tostring+” ', ’ β€œ+row(β€œurl”).Tostring+” ', ’ β€œ+row(β€œprice”).Tostring+” ')”