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>