dont know about mysql, but this is how i do it in mssql2k : <cfquery name="getMaxObject" datasource="#dsn#" > SET NOCOUNT ON INSERT INTO Objects (EmployeeID, patientID, ObjectTypeID) VALUES (<cfqueryparam cfsqltype="CF_SQL_INTEGER" value="#session.whoami#">, <cfqueryparam cfsqltype="CF_SQL_INTEGER" value="#form.patientid#">, <cfqueryparam cfsqltype="CF_SQL_INTEGER" value="27">) SELECT @@identity as maxObjectID SET NOCOUNT OFF </cfquery>
then to get the value i do #getMaxObject.maxObjectID#. give it a shot? -alex >Is this the best way to do this: > ><cftransaction> > <cfquery name="InsertAddress" datasource="#DSN#"> > INSERT INTO Address (City) > VALUES (<cfqueryparam value="#City#" cfsqltype="cf_sql_integer" />) > </cfquery> > > <cfquery name="getInsertedID" datasource="#DSN#"> > SELECT MAX(AddressID) as MaxID > FROM Address > </cfquery> ></cftransaction> > >I'm using MySQL. > >Cheers, >Baz ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:229392 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54