The tContact table has a primary key, ContactID, that is of type identity.
<cffunction name="Create" returntype="query">
<cfargument name="theParams" type="struct" default="#this#" required="yes" >
<cfargument name="DSN" type="string" default="#this.DSN#">
<cfset var qtContact_INS = "" >
<cfquery name="qtContact_INS" datasource="#Arguments.DSN#" maxrows=-1 >
BEGIN TRANSACTION
INSERT INTO dbo.tContact
(
[ContactTypesID],
[StatusID],
[TimeZoneID]
)
VALUES
(
<cfqueryparam value="#theParams.$ContactTypesID#" cfsqltype="CF_SQL_smallint" >,
<cfqueryparam value="#theParams.$StatusID#" cfsqltype="CF_SQL_smallint" >,
<cfqueryparam value="#theParams.$TimeZoneID#" cfsqltype="CF_SQL_smallint" >
)
SELECT [ContactID]
FROM dbo.tContact
WHERE ContactID = SCOPE_IDENTITY()
COMMIT TRAN
</cfquery>
<cfreturn qtContact_INS >
</cffunction>
(Reference: This code is exactly what CFSQLTool generates.)
Joseph
http://www.switch-box.org/CFSQLTool/Download/
Switch_box
www.Switch-box.org
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.
CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).
CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm
An archive of the CFCDev list is available at www.mail-archive.com/[email protected]
