Execute Non Query: Syntax error in INSERT INTO statement

Hello team,
I’m facing the same error while executing the project. Help me to solve this error

strQuery= “INSERT INTO FundTransaction (FundName,RequestType,RequestFrom,RequestStatus,Quantity) VALUES (”+""+fundName+","+""+fundtype+","+""+userAddress+","+“Received”+","+""+fundQuantity+""+" ) ;"

Hi @Vrushali_Gave

Below is the syntax.

If der are only this 5 fields then below syntax is correct. If any null values are der then plzz let me know.

“INSERT INTO FundTransaction VALUES (’”+fundName+"’,’"+fundtype+"’,’"+userAddress+"’,’"+Received+"’,’"+fundQuantity+"’)"

Hope this may help to solve your issue
Mark as solution if this helps you and like it :innocent:

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

Hello @Pratik_Wavhal sir Received is not a variable. Its a string “Received” which I want to just print it into the database.

Now I’m getting this error :
Execute Non Query: No value given for one or more required parameters.

Hi @Vrushali_Gave

So those are not your parameters variable. I thought they are so.

“INSERT INTO FundTransaction VALUES (’”+fundName+"’,’"+fundtype+"’,’"+userAddress+"’,’“Received”’,’"+fundQuantity+"’)"

Hope this may help to solve your issue
Mark as solution if this helps you and like it :innocent:

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

@Pratik_Wavhal Thank you sir …but still its giving me the same error

Hi @Vrushali_Gave

Try doing without double quotes
“INSERT INTO FundTransaction VALUES (’”+fundName+"’,’"+fundtype+"’,’"+userAddress+"’,’Received’,’"+fundQuantity+"’)"

Hope this may help to solve your issue
Mark as solution if this helps you and like it :innocent:

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

@Pratik_Wavhal sir still same error

Hi @Vrushali_Gave

Can you provide me your .xaml file.
So that i can solve it within that instead of giving many options.

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

yes sir sure

@Pratik_Wavhal sir here it is
Main.xaml (12.0 KB)

@Vrushali_Gave

Check attached

Let me know if you face any problems

Main.xaml (12.8 KB)

Mark as solution if this helps

Thanks

Hi @Vrushali_Gave

Your issue is solved. Instead of single quotes something diff you were using.
Actually for testing purpose i have created one dummy Db of same fields and the it start working with the single quotes i mentioned.

Output in DB :-
image

The thing i told you was already correct in previous 6th post about the syntax like this ‘Recieved’ but you were using wrong Single quotes. And if you want to give the column name within the query you can give or else not also.
Below is the correct one.


“INSERT INTO [FundTransaction] VALUES (’”+fundName+"’,’"+fundtype+"’,’"+userAddress+"’,‘Recieved’,’"+fundQuantity+"’)"

Just uncomment this part.
image

And remove this default variables i have created for testing purpose.
image

I have attached the Updated .xaml file.
VrushaliMain.xaml (15.7 KB)

Mark as solution and like it :innocent:

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

Hi @Vrushali_Gave

I am attaching both the workflow in which your issue is solved.
Main (1).xaml (13.8 KB)
Main (2).xaml (13.8 KB)

With in both workflow i have done with 2 ways as below :-

  1. Either by using ForEach Activity for retireving the elements from array as per der index and store in some variable as shown in below SS
    image

OR

  1. By Using arrayVariable.ElementAt(index) as shown below
    image

Mark as solution and like it :innocent:

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

@Pratik_Wavhal Thank you for the reply …see what is my problem statement is that I’m receiving thousands of mail every day on particular email id so my work is to read that mails and store such essential data into ms access database. Now I’m automating this task in RPA for that I have designed a workflow in which I’m fetching the subject of mail .
**For Example : **
Sender : xyz@gamil.com
Subject : Buy,678,ABC/EF
Body: Product Details


I have three variables : fundName,fundType,fundQuantity
So subject will split into three index
fundName=ABC/EF
fundType=Buy
fundQuantity=678

As per the above explanation, it will store that details into a database for that I have used Insert query.

Hi @Vrushali_Gave

So what error you are getting now ??
As of now i have solve the previous error what you were facing.

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

@Pratik_Wavhal see same error getting

I dont understand for what reason it throws this error