Showing results for 
Search instead for 
Did you mean: 

Groovy Question sql.execute

Super Contributor

Groovy Question sql.execute

I have a groovy statement

boolean status = sql.execute("UPDATE dbo.aspnet_Membership set IsApproved = 1 where LoweredEmail=${Email}");

I check the database and verify that the update actually happened. However, regardless of the outcome the sql.execute() always seems to return 'false'. Do you if I am doing any thing wrong.

I want to throw an exception if it returns false and dont throw any exception if it returns true.  but at the moment I cant figure out how to throw true.


Super Contributor

Re: Groovy Question sql.execute

Hi Ali,

sql.execute returns a boolean indicating if the result is a resultSet.. in your case always false.. If something goes wrong, the execute call itself will throw an exception..

Hope this helps!


New Here?
Join us and watch the welcome video:
Script Wanted
Let's start July with new challenges!

Create a script to change request body before sending it to the server for the TechCorner tag!

Scripts created in June:
- A script to generate a request body based on data from Datasource
- A script to go through all response nodes and check the value of the required field
- A Dispatching script to get responses based on the values in Request Body
- A script to add a new tag and assign it to all TestCases in a TestSuite
Top Kudoed Authors