Skip to main content
March 31, 2011
Answered

making sure a row was inserted, updated, or deleted

  • March 31, 2011
  • 3 replies
  • 638 views

What is the best way to make sure a Coldfusion query run ?

For updates and deletes, what I am starting to do is use result in cfquery and make sure result name dot recordcount is 1.

For inserts, I'm checking to see if result name dot identitycol is there.

Are those good ways to do make sure queries ran ?

This topic has been closed for replies.
Correct answer Amiya_Padhi

Added to that we can also use cftry and cfcatch tag to handle the error if anything wrong occurs at the runtime. If we are having any interdependent statement like insert than update and if update failed than we should roll back the insertion then we can go for cftransaction tag.

3 replies

Inspiring
March 31, 2011

If they didn't run, you'll get an error.  That's the easiest way to tell...

--

Adam

Inspiring
March 31, 2011

Run a select query afterwards and display the new results to someone who cares.  That someone doesn't have to be the user.

Amiya_PadhiCorrect answer
Participating Frequently
March 31, 2011

Added to that we can also use cftry and cfcatch tag to handle the error if anything wrong occurs at the runtime. If we are having any interdependent statement like insert than update and if update failed than we should roll back the insertion then we can go for cftransaction tag.