• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Current Status of CFQUERY

Guest
May 09, 2006 May 09, 2006

Copy link to clipboard

Copied

Is there any way to know the status of cfquery Insert . i.e the insert was successful or aborted or any other returning Code which tells that ? .
TOPICS
Advanced techniques

Views

514

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
May 09, 2006 May 09, 2006

Copy link to clipboard

Copied

Unless you have set up your database in an unusual manner then SQL is either successful or throws an error.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 09, 2006 May 09, 2006

Copy link to clipboard

Copied

hmm there is way around through triggers but that not what i am looking for . so CFQUERY it self is unable to return any status. interesting.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 09, 2006 May 09, 2006

Copy link to clipboard

Copied

You could use cftry/cfcatch and write your own message of success. In fact, if your delete query has foreign key issues, this might not be a bad idea.

Actually a better idea is to delete the related records first.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
May 10, 2006 May 10, 2006

Copy link to clipboard

Copied

LATEST
If you are using SQL Server, read the Books Online under Help in SQL Query Analyzer. Look into @@ROWCOUNT, RAISERROR, BEGIN TRANSACTION, ROLLBACK TRANSACTION. Also look into CFTRANSACTION in CF.

A quick, simple way is to run a select immediately following the insert. If the record is there, the insert was successful.
This is just a quick and dirty way to check. There are better options.


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation