Trap ODBC error code

I would like to check for the existance of a SQL table via COLD FUSION.  I run a DROP TABLE tblxyz; and then would like to check for an ODBC error code S0002 in the case if the table does not yet exist.  If this is the case I want to branch around and get past the error.
tschiroAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
bigbadbConnect With a Mentor Commented:
<CFTRY>
      <cfquery datasource="ohiotest" name="testme">
            select *
            from tblxyz
      </cfquery>
<CFCATCH type="Database">
      <cflocation url="newpage.cfm">
</CFCATCH>
</cftry>



Something like this would work where newpage is the direct to

Hope this works
0
 
anushaCommented:
bigbadb,

Is there a way to do the CFCATCH if I am using CF3.1 which does not support this tag?

Anusha
0
 
bigbadbCommented:
you can try cferror but it doesnt work nearly as well as cfcatch and cfcatch is only available in CF 4.0
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.