Need to insert one row every time after reading data from data table

Hi All,

I am inserting records after reading them from a CSV file & storing it in a data table variable.
If I want to insert static values then works fine for me but when I try to read the values from the above data table & then insert records one by one after checking some column data for validation then how to pass the variables that I defined to pass in my insert query

Ex of static data:- “Insert into [Health Care Records].[dbo].[DoctorDetails] ( [Doctor Name],[Doctor ID],[Doctor Available Days],[Doctor Location]
,[Doctor Timing] ,[Doctor Type]) values (‘Name’,‘ID’,‘Days’,‘Location’,‘Timing’,‘General’)”

But now I want to pass the data reading from the data table into this query, can someone guide me, please?

Hi @Aditya_Singhania

Have you added UiPath.Database.Activities dependencies ? Execute Non Query activity can pass variables as parameters.

Thanks for your prompt response @GreenTea , but i tried doing the same but it gives me error.
I tried the below query
"Insert into [Health Care Records].[dbo].[DoctorDetails] ( [Doctor Name],[Doctor ID],[Doctor Available Days],[Doctor Location]
,[Doctor Timing] ,[Doctor Type]) values (name, id, days, location, timing, type ) "

name, id are variable names that I have declared.

Can you please try to correct the query if I missed any syntax

Hi @Aditya_Singhania

Please check if your error message is any one of these:

  1. Excel - insert into - execute non query database
  2. Database activities Execute Non Query failing, query '' corrupt - #6 by Palaniyappan
  3. How to insert data into Database from using UiPath, getting error "Invalid Column Name"
  4. Execute Non Query: Input string was not in a correct format