Roberto Perez said:
>
> I'm using ColdFusion MX and Access 2000. I have a strange error that
> ocurrs  with CF talking to the Access database using CFTRANSACTION.
> What I'm doing  is insert a record to the Access table and then get
> the autonumber value in  the Respondent field. I insert with INSERT
> (duh) and I get the number with  SELECT max(Respondent). The whole
> sequence is preceded by a <cfif
> IsDefined("FORM.MM_InsertRecord")...> to check for the previous page
> that  has the form. I'm enclosing both queries (insert and select)
> within  CFTRANSACTION, so I know there is no other INSERT operation
> in between my  inserting a record and getting the number.

That requires the transaction to be seriaizable.

> I get an error message saying "ReferenceError:
> NotFoundMessage is not defined" coming from the
> DreamweaverMX/Configuration/Shared/Controls/Scripts/ConnectionTableMenu.js
>  file.
>
> If I put the CFTRANSACTION after the cfif and right before the /cfif
> and  save, I get the error "TypeError: the _expression_ has not
> properties" this  time from
> DreamweaverMX/Configuration/ServerModels/ColdFusion/dwscriptsServerImpl.js

DreamWeaver errors mean very little. Debug in a normal browser and
look at the CF errors.

> Any advice/pointers/possible solutions/alternatives to implement?

<cfif IsDefined("FORM.MM_InsertRecord") AND FORM.MM_InsertRecord EQ
"SurveyConsent">

  <cftransaction action="" isolation="serializable">
  <!--- Note: don't know if Access actually supports serializable --->

    <cfquery datasource="survey_ds">
      INSERT INTO et_data_tb (
        Consent,
        AccessCode,
        InsLastName,
        InsFirstName,
        RealCourse,
        RealSection,
        RealInsGender,
        RealInsCountry
        )
      VALUES (
        <cfqueryparam cfsqltype="cf_sql_varchar"
value="#FORM.Consent#" null="#YesNoFormat(not
Len(FORM.Consent))#">,
        <cfqueryparam cfsqltype="cf_sql_varchar"
value="#FORM.AccessCode#" null="#YesNoFormat(not
Len(FORM.AccessCode))#">,
        <!--- Make sure you convert the rest of your parameters too --->
        )
    </cfquery>

    <CFQUERY NAME="GetRespondentNumber" DATASOURCE="survey_ds">
      SELECT max(Respondent) as RespondentNumber
      FROM et_data_tb
    </CFQUERY>
    <CFSET Respondent = GetRespondentNumber.RespondentNumber>
  </CFTRANSACTION>

  <cflocation addtoken="no"
url="">
</cfif>

Jochem
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to