Forum Discussion

alibaba82's avatar
alibaba82
Super Contributor
17 years ago

Groovy Question sql.execute

Hello,
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.

Thanks

Ali

1 Reply

  • omatzura's avatar
    omatzura
    Super Contributor
    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!

    regards,

    /Ole
    eviware.com