Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 631509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T19:58:23+00:00 2026-05-13T19:58:23+00:00

In ColdFusion 8 or below, is the marked line in the right place? <cftry>

  • 0

In ColdFusion 8 or below, is the marked line in the right place?

<cftry>
  <cfquery name="local.qry" datasource="myDatasource">
    SELECT ID FROM TableName
    WHERE ...
  </cfquery>
  <cfset local.result = local.qry.ID><!--- this line! --->
  <cfcatch>
    <cfset local.result = Variables.objDatabase.CatchError(cfcatch)>
  </cfcatch>
</cftry>

<cfreturn local.result>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T19:58:24+00:00Added an answer on May 13, 2026 at 7:58 pm

    Yes. You could set it outside of the block, but why? At least this way, you’ll catch any bizarre errors that might occur during assignment. It’s not likely, but the query could succeed and the assignment could fail, so why not trap that potential issue?

    You’ve already got the overhead of a try/catch, might as well add the assignment to the try block as well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im trying to generate a color gradient using ColdFusion. My current code below works
In ColdFusion, if you want to reference <cfargument name=x> then you say: arguments.x In
I am trying to access userdata I have sent from the server (using coldfusion)
I am using ColdFusion 9, with create a verity collection name 'shopColl'. I create
I need to read a cookie created on https://sub1.domain.com from http://origin.domain.com using ColdFusion. I've
In ColdFusion I can see the code below, however it does not seem to
I am generating the sql statement below based on some coldfusion logic, but it
I am using ColdFusion 9. I am outputting a chunk of text from a
I have a Coldfusion Webservice that returns json data like below: {rows:[{cell:[43,USA,jon,doe,doe@gmail.com,HR],id:43}, {cell:[44,JAPAN,tanaka,yidi,yidi@aol.com,IT],id:44}], page:1,records:2,total:1}
I'm working on a coldfusion line trying to work out what this line means.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.