Question
Syntax error in UPDATE statement
I know this is a very basic process but for the life of me, I
can't figure out what is wrong wide my code. I have created a
simple Access database named Jobs. There are four fields within
this database, the Primary Key, "Position" "Needs" and "Necessary".
(I originally had them as Position, Description and Requirements
but was told my issue might be that those were reserved words.)
Anyway, here is the code to the update form cfm page:
<cfquery name= "JobPost"
datasource="kpstool_accesscf_jobs">
SELECT * FROM jobs WHERE JobID = #Form.position#
</cfquery>
<cfoutput query= "JobPost">
<form action="Updatepage.cfm" Method="Post" name="Form" id="Form">
<p>
<table width="473" border="1">
<tr>
<td width="84">Position:</td>
<td width="373">
<input type="text" name="Position" value="#Position#"></td>
</tr>
<tr>
<td>Needs:</td>
<td><input type="text" name="Needs" value="#Needs#"></td>
</tr>
<tr>
<td>Necessary:</td>
<td><input type="text" name="Necessary" value="#Necessary#"></td>
</tr>
<tr>
<td colspan="2"><input name="submit" type="submit" value="Update Information"></td>
</tr>
</table>
<p><br>
<br>
</form>
</cfoutput>
Now here is the code for the update page cfm:
<cfquery name="JobPost"
datasource= "kpstool_accesscf_jobs">
UPDATE Jobs
SET Position = '#Form.Position#',
Needs = '#Form.Needs#',
Necessary = '#Form.Necessary#'
WHERE Position = President
</cfquery>
<cfoutput>
You have updated the information for added #Form.Position#
#Form.Needs#
to the Job Listing database
</cfoutput>
Lastly, here's the error I am getting:
Error Executing Database Query.
Syntax error in UPDATE statement.
The error occurred in D:\Hosting\kpstool\updatepage.cfm: line 134
132 : SET Position = '#Form.Position#',
133 : Needs = '#Form.Needs#',
134 : Necessary = '#Form.Necessary#'
135 : WHERE Position = President
136 : </cfquery>
SQL UPDATE Jobs SET Position = 'President', Needs = 'Tell people what to do', Necessary = 'Must yell' WHERE Position = President
DATASOURCE kpstool_accesscf_jobs
VENDORERRORCODE 3092
SQLSTATE
ANY help would be GREAT!
Dave
Anyway, here is the code to the update form cfm page:
<cfquery name= "JobPost"
datasource="kpstool_accesscf_jobs">
SELECT * FROM jobs WHERE JobID = #Form.position#
</cfquery>
<cfoutput query= "JobPost">
<form action="Updatepage.cfm" Method="Post" name="Form" id="Form">
<p>
<table width="473" border="1">
<tr>
<td width="84">Position:</td>
<td width="373">
<input type="text" name="Position" value="#Position#"></td>
</tr>
<tr>
<td>Needs:</td>
<td><input type="text" name="Needs" value="#Needs#"></td>
</tr>
<tr>
<td>Necessary:</td>
<td><input type="text" name="Necessary" value="#Necessary#"></td>
</tr>
<tr>
<td colspan="2"><input name="submit" type="submit" value="Update Information"></td>
</tr>
</table>
<p><br>
<br>
</form>
</cfoutput>
Now here is the code for the update page cfm:
<cfquery name="JobPost"
datasource= "kpstool_accesscf_jobs">
UPDATE Jobs
SET Position = '#Form.Position#',
Needs = '#Form.Needs#',
Necessary = '#Form.Necessary#'
WHERE Position = President
</cfquery>
<cfoutput>
You have updated the information for added #Form.Position#
#Form.Needs#
to the Job Listing database
</cfoutput>
Lastly, here's the error I am getting:
Error Executing Database Query.
Syntax error in UPDATE statement.
The error occurred in D:\Hosting\kpstool\updatepage.cfm: line 134
132 : SET Position = '#Form.Position#',
133 : Needs = '#Form.Needs#',
134 : Necessary = '#Form.Necessary#'
135 : WHERE Position = President
136 : </cfquery>
SQL UPDATE Jobs SET Position = 'President', Needs = 'Tell people what to do', Necessary = 'Must yell' WHERE Position = President
DATASOURCE kpstool_accesscf_jobs
VENDORERRORCODE 3092
SQLSTATE
ANY help would be GREAT!
Dave
