DataMgr 2.5 Documentation: Replace cfinsert/cfupdate

Replace cfinsert/cfupdate

DataMgr can act as a replacement for cfinsert and cfupdate with several advantages.

<cfif isDefined("Form.employee_id") AND isNumeric(Form.employee_id)>
	<cfupdate datasource="#request.dsn#" tablename="employees">
<cfelse>
	<cfinsert datasource="#request.dsn#" tablename="employees">
</cfif>

Using DataMgr:

<cfif isDefined("Form.employee_id") AND isNumeric(Form.employee_id)>
	<cfset Application.DataMgr.insertRecord("employees",Form)>
<cfelse>
	<cfset Application.DataMgr.updateRecord("employees",Form)>
</cfif>

Using DataMgr to automatically determine insert or update action and return primary key:

<cfset employee_id = Application.DataMgr.saveRecord("employees",Form)>