0 Replies Latest reply on Sep 16, 2010 8:47 PM by Daniel Pride

    Retrieving auto incremented Id in Flashbuilder/ColdFusion/MySQL

    Daniel Pride Level 1

      If you auto generate a cfc in Coldfusion from Flashbuilder you get something like


          <cffunction name="createLineItems" output="false" access="remote" returntype="any" >
              <cfargument name="item" required="true" />

              <cfquery name="createItem" datasource="BlueRose" result="result">
                  INSERT INTO LineItems (ApptDate, Cid, Iid, Description, Price, Length)
                          VALUES (<CFQUERYPARAM cfsqltype="CF_SQL_TIMESTAMP" VALUE="#item.ApptDate#">,

                                  <CFQUERYPARAM cfsqltype="CF_SQL_VARCHAR" VALUE="#item.Description#">,
                                  <CFQUERYPARAM cfsqltype="CF_SQL_DECIMAL" VALUE="#item.Price#">,

              <cfreturn result.GENERATED_KEY/>       


      When you call it from the FB Script to store a record in the database by passing in a valueObject like

                createLineItemsResult.token = lineItemsService.createLineItems(selectedLineItem);


      Then How do you reference the returned id generated in Mysql so you can use it in the script?

      I would like to refence the returned value object from the new database record with all its values including the newly created Id

      NOT the valueObject data which I used to insert and create the record???



      Dan Pride