Reputation: 7397
I am trying to query the database and have it find the correct id and update the id at the correct number it is assigned to and then have it find the Date_Complete field and have it update with todays date.
<cfquery name="completeBatch">
UPDATE dbo.Dealer_Track_Work (Date_Complete)
SET Date_Complete = getDate()
WHERE id = 5
</cfquery>
I thought this would update the Date_Complete field where id equals the 5th id (which increments by 1 as there submitted into the database). And that it would set the Date_Complete to todays date. All I am getting is a blank screen with nothing happening to the database.
Any help on this would be greatly appreciated.
This is what I am trying to get to work to create my function for it to work properly.
<cfcomponent>
<cffunction name="updateRecord" access="remote" returntype="void">
<cfargument name="id" type="numeric" required="true">
<cfset var completeBatch = ''>
<cfquery name="completeBatch">
UPDATE dbo.Dealer_Track_Work (Date_Complete)
SET Date_Complete = getDate()
WHERE ID = <cfqueryparam value="#arguments.id#" cfsqltype="cf_sql_integer">
</cfquery>
</cffunction>
</cfcomponent>
Upvotes: 0
Views: 136
Reputation: 14333
There's no need for the (Date_Complete)
in your UPDATE
<cfquery name="completeBatch">
UPDATE dbo.Dealer_Track_Work
SET Date_Complete = getDate()
WHERE ID = <cfqueryparam value="#arguments.id#" cfsqltype="cf_sql_integer">
</cfquery>
Upvotes: 3