Skip to main content
Inspiring
January 22, 2009
Question

<CFTRY>

  • January 22, 2009
  • 7 replies
  • 683 views
I'm curious why with this:

<cftry>
<cfquery name="AddRequest" datasource="SB">
insert into inforeq
(Cust_Name, Cust_Address, Cust_Address2, Cust_City, Cust_State,
Cust_Zip, Cust_Email, Cust_MailInfo, Cust_Events, Cust_Class,
Cust_Info_Sent, Cust_Newsletter,Cust_Beg_Class, Cust_Lat, Cust_Long)
values
(<cfqueryparam cfsqltype="cf_sql_varchar"
value="#CapFirstTitle(strName)#">,<cfqueryparam cfsqltype="cf_sql_varchar"
value="#CapFirstTitle(arguments.Address1)#">,<cfqueryparam
cfsqltype="cf_sql_varchar"
value="#CapFirstTitle(new_Address2)#">,<cfqueryparam
cfsqltype="cf_sql_varchar"
value="#CapFirstTitle(arguments.City)#">,<cfqueryparam
cfsqltype="cf_sql_char" value="#ucase(arguments.State)#">,<cfqueryparam
cfsqltype="cf_sql_varchar" value="#arguments.Zip#">,<cfqueryparam
cfsqltype="cf_sql_varchar" value="#arguments.Email#">, <cfqueryparam
cfsqltype="cf_sql_integer" value="#arguments.Info#">,<cfqueryparam
cfsqltype="cf_sql_integer" value="#arguments.Events#">,<cfqueryparam
cfsqltype="cf_sql_integer" value="#arguments.Class#">,<cfqueryparam
cfsqltype="cf_sql_integer" value="#arguments.Info_Sent#">,<cfqueryparam
cfsqltype="cf_sql_integer" value="#arguments.News#">,<cfqueryparam
cfsqltype="cf_sql_integer"
value="#arguments.Beg_Class#">,#mylat#,#mylng#)</cfquery>
<cfcatch type="database">
<cfset session.dbResult="#cfcatch.SQLState#">
<cflocation url="../test101.cfm" addtoken="no">
</cfcatch>
</cftry>

I'm not getting a result for #cfcatch.SQLState# ?? When I output the value
of session.dbResult, its N/A.......

This is on a MySql database..... if that helps

    This topic has been closed for replies.

    7 replies

    Inspiring
    January 24, 2009
    >> Well... is the query actually erroring?

    > It should be, I changed the datasource to something that didn't exist

    I'm not asking whether it *should be* erroring. *Is it* erroring? This is
    not a time for circumspection.

    >> I'm not getting a result for #cfcatch.SQLState#

    The docs *do* say that one should not rely on that value:
    http://livedocs.adobe.com/coldfusion/8/Tags_c_04.html

    --
    Adam
    Inspiring
    January 23, 2009
    Ok, now I'm getting:
    coldfusion.tagext.sql.QueryTag$DataSourceException: Datasource SB could not
    be found.

    "Dan Bracuk" <webforumsuser@macromedia.com> wrote in message
    news:glcqgr$jvk$1@forums.macromedia.com...
    > How very odd. When I do this:
    >
    > <cftry>
    > <cfquery name="x" datasource="incorrect">
    > select 1 from dual
    > </cfquery>
    > <cfcatch>
    > <cfdump var="#cfcatch#">
    > </cfcatch>
    > </cftry>
    >
    > I get a structure being dumped.
    > The Message is "Data source incorrect could not be found."
    > The SQL State is "n/a".
    >
    > What do you get with the same code I ran?
    >

    Inspiring
    January 23, 2009
    How very odd. When I do this:

    <cftry>
    <cfquery name="x" datasource="incorrect">
    select 1 from dual
    </cfquery>
    <cfcatch>
    <cfdump var="#cfcatch#">
    </cfcatch>
    </cftry>

    I get a structure being dumped.
    The Message is "Data source incorrect could not be found."
    The SQL State is "n/a".

    What do you get with the same code I ran?
    Inspiring
    January 23, 2009
    With a incorrect datasource, and using a <cfdump> I get a 1 for the
    dump...... no error message, just a white screen with 1 on it........

    "Dan Bracuk" <webforumsuser@macromedia.com> wrote in message
    news:glcfji$76a$1@forums.macromedia.com...
    > change this:
    > <cfset session.dbResult="#cfcatch.SQLState#">
    > <cflocation url="../test101.cfm" addtoken="no">
    >
    > to this
    > <cfdump var="#cfcatch#"> and look at the output.

    Inspiring
    January 23, 2009
    It should be, I changed the datasource to something that didn't exist

    "Adam Cameron" <adam_junk@hotmail.com> wrote in message
    news:1pufm20vo2uio.1izkqkkqhpsbn$.dlg@40tude.net...
    >> I'm curious why with this:
    >>
    >> <cftry>
    >> <cfquery name="AddRequest" datasource="SB">
    > [...]
    >> value="#arguments.Beg_Class#">,#mylat#,#mylng#)</cfquery>
    >> <cfcatch type="database">
    >> <cfset session.dbResult="#cfcatch.SQLState#">
    >> <cflocation url="../test101.cfm" addtoken="no">
    >> </cfcatch>
    >> </cftry>
    >>
    >> I'm not getting a result for #cfcatch.SQLState# ?? When I output the
    >> value
    >> of session.dbResult, its N/A.......
    >>
    >> This is on a MySql database..... if that helps
    >
    > Well... is the query actually erroring?
    >
    > --
    > Adam

    Inspiring
    January 23, 2009
    change this:
    <cfset session.dbResult="#cfcatch.SQLState#">
    <cflocation url="../test101.cfm" addtoken="no">

    to this
    <cfdump var="#cfcatch#"> and look at the output.
    Inspiring
    January 23, 2009
    > I'm curious why with this:
    >
    > <cftry>
    > <cfquery name="AddRequest" datasource="SB">
    [...]
    > value="#arguments.Beg_Class#">,#mylat#,#mylng#)</cfquery>
    > <cfcatch type="database">
    > <cfset session.dbResult="#cfcatch.SQLState#">
    > <cflocation url="../test101.cfm" addtoken="no">
    > </cfcatch>
    > </cftry>
    >
    > I'm not getting a result for #cfcatch.SQLState# ?? When I output the value
    > of session.dbResult, its N/A.......
    >
    > This is on a MySql database..... if that helps

    Well... is the query actually erroring?

    --
    Adam