Eh, sorry, once I read that again I realized it wasn't a clear example... The "ID"
field was a foreign key in the original code I took this from. Just ignore the ID
part entirely :)
<cfquery name="enterRecord" datasource="#attributes.DSN#" dbtype="ODBC">
SET NOCOUNT ON
INSERT INTO myTable (name)
VALUES ('#attributes.name#')
SELECT newID = @@IDENTITY
SET NOCOUNT OFF
</cfquery>
<cfset newID = enterRecord.newID>
-Max
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists