>
> Thanks for that. I'll stick with the simple stuff until I get a bit
> better at this stuff. I've put in the necessary code but I'm getting a
> "Element PROPERTYAGENTID is undefined in GETUSERID." Error.
>
> Can you see what I'm doing wrong?
>
> <cftransaction action=""> >
> <CFQUERY NAME="InsertPropertyDetails" datasource="020">
> INSERT INTO PropertyAgent
> (PropertyAgentCompanyName, PropertyAgentFlatNumberHouseName,
> PropertyAgentStreetNumber, PropertyAgentStreetName,
> PropertyAgentVillageTown, PropertyAgentCountyState,
> PropertyAgentPostcodeZip, PropertyAgentCountry,
> PropertyAgentTelephoneNumber, PropertyAgentContactFirstName,
> PropertyAgentContactSurname, PropertyAgentContactMobile,
> PropertyAgentEmailAddress, PropertyAgentAuthorityLevel,
> PropertyAgentDateAdded, PropertyAgentViewDefinitions,
> PropertyAgentCreatedBy)
> VALUES
> ('#Form.PropertyAgentCompanyName#',
> '#Form.PropertyAgentFlatNumberHouseName#',
> #Form.PropertyAgentStreetNumber#, '#Form.PropertyAgentStreetName#',
> '#Form.PropertyAgentVillageTown#', '#Form.PropertyAgentCountyState#',
> '#Form.PropertyAgentPostcodeZip#', '#Form.PropertyAgentCountry#',
> #Form.PropertyAgentTelephoneNumber#,
> '#Form.PropertyAgentContactFirstName#',
> '#Form.PropertyAgentContactSurname#', #Form.PropertyAgentContactMobile#,
> '#Form.PropertyAgentEmailAddress#', #Form.PropertyAgentAuthorityLevel#,
> #UKDate#, '#GetDefaultViewDefinitions.ViewDefinitions#',
> #Client.PropertyAgentID#)
> </CFQUERY>
>
> <CFQUERY NAME="GetUserID" datasource="020">
> SELECT MAX(PropertyAgentID)
> FROM
> PropertyAgent
> </CFQUERY>
>
> <cfoutput>#GetUserID.PropertyAgentID#</cfoutput>
>
> </cftransaction>
>
You need to alias that column because you are using an aggregate function,
like so:
<CFQUERY NAME="GetUserID" datasource="020">
SELECT MAX(PropertyAgentID) AS MaxID
FROM
PropertyAgent
</CFQUERY>
One side note, *please* look in to using cfqueryparam with your values.
Regards,
Dave.
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

