Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Code Review, Update process Does NOT work 1

Status
Not open for further replies.

lovecf

Programmer
Mar 4, 2001
9
US
This is the form page:


<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;>
<!--- include toolbar.cfm--->
<cfinclude template=&quot;Toolbar.cfm&quot;>
<html>
<head>
<CFPARAM Name=&quot;ID&quot; Default=1>
<title>Interview 2</title>
</head>
<CFQUERY NAME=&quot;selectcandidate&quot; DATASOURCE=&quot;interview&quot;>
SELECT ID, EmpCandidate, SKillBackground, Status, Recruiter, Profile, InitialIntdate, InitialInt, TechIntvdate, TechIntv, PeerInterviewdate, PeerInterview, MarkInterdate, MarkInter, ExtOfferdate, CheckRef, StartDate, Comments
FROM interview
WHERE ID=#ID#
</CFQUERY>
<cfform action=&quot;interview2action.cfm&quot; method=&quot;POST&quot;>


<CFSET NextID=#id#+1>
<CFSET PrevID=#id#-1>

<body bgcolor=&quot;6699ff&quot;>
<cfoutput query=&quot;selectcandidate&quot;>

<input type=&quot;hidden&quot; name=&quot;id&quot; value=&quot;#id#&quot;>

<table width=&quot;95%&quot; border=&quot;1&quot; align=&quot;center&quot; bgcolor=&quot;6699ff&quot; >
<tr>
<td>ID</td>
<td>Candidate Name</td>
</tr>
<tr>
<td>&nbsp;#ID#</td>
<td>&nbsp;#EmpCandidate#</td>
</tr>
<tr>
<td>Initial Interview Date</td>
<td>Initial Interview Notes</td>
</tr>
<tr>
<td valign=&quot;top&quot;>&nbsp;<cfinput type=&quot;Text&quot; name=&quot;InitialIntdate&quot; value=&quot;#InitialIntdate#&quot;></td>
<td>&nbsp;<textarea cols=&quot;65&quot; rows=&quot;5&quot; name=&quot;InitialInt&quot;>#InitialInt#</textarea></td>
</tr>
<tr>
<td>Technical Interview Date</td>
<td>Technical Interview Notes</td>
</tr>
<tr>
<td valign=&quot;top&quot;>&nbsp;<cfinput type=&quot;Text&quot; name=&quot;TechIntvDate&quot; value=&quot;#Techintvdate#&quot;></td>
<td>&nbsp;<textarea cols=&quot;65&quot; rows=&quot;5&quot; name=&quot;TechIntv&quot;>#TechIntv#</textarea></td>
</tr>
<tr>
<td>Peer Interview Date</td>
<td>Peer Interview Notes</td>
</tr>
<tr>
<td valign=&quot;top&quot;>&nbsp;<cfinput type=&quot;Text&quot; name=&quot;PeerInterviewdate&quot; value=&quot;#PeerInterviewdate#&quot; required=&quot;No&quot;></td>
<td>&nbsp;<textarea cols=&quot;65&quot; rows=&quot;5&quot; name=&quot;PeerInterview&quot;>#PeerInterview#</textarea></td>
</tr>
<tr>
<td>Marketing Interview Date</td>
<td>Marketing Interview Notes</td>
</tr>
<tr>
<td valign=&quot;top&quot;>&nbsp;<cfinput type=&quot;Text&quot; name=&quot;MarkInterdate&quot; value=&quot;#MarkInterdate#&quot; required=&quot;No&quot;></td>
<td>&nbsp;<textarea cols=&quot;65&quot; rows=&quot;5&quot; name=&quot;MarkInter&quot;>#MarkInter#</textarea></td>
</tr>
<tr>
<td valign=&quot;top&quot;>Offer Extended Date</td>
<td>Reference Check</td>
</tr>
<tr>
<td valign=&quot;top&quot;>&nbsp;<cfinput type=&quot;Text&quot; name=&quot;ExtOfferdate&quot; value=&quot;#ExtOfferdate#&quot;></td>
<td>&nbsp;<textarea cols=&quot;65&quot; rows=&quot;5&quot; name=&quot;CheckRef&quot;>#CheckRef#</textarea></td>
</tr>
<tr>
<td>Start Date</td>
<td>Additional Comments</td>
</tr>
<tr>
<td valign=&quot;top&quot;>&nbsp;<cfinput type=&quot;Text&quot; name=&quot;StartDate&quot; value=&quot;#StartDate#&quot; required=&quot;No&quot;></td>
<td><textarea cols=&quot;65&quot; rows=&quot;5&quot; name=&quot;Comments&quot;>#Comments#</textarea></td>
</tr>
</table>

<table width=&quot;85%&quot; border=&quot;0&quot;>
<TR>
<TD align=&quot;left&quot;><a href=&quot;interview2.cfm?ID=#PrevID#&quot;>Previous</a></TD>
<td align=&quot;right&quot;><a href=&quot;interview2.cfm?ID=#NextID#&quot;>Next</a></td>
</td></TR></table>
</cfoutput>
<input type=&quot;submit&quot; name=&quot;Action&quot; value=&quot;Update Criteria&quot;>
</cfform>
</body>
</html>

This is the Action Page:

<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;>

<html>
<head>
<title>Update Candidates Information</title>
</head>
<!--- Update --->
<CFQUERY NAME=&quot;update&quot; DATASOURCE=&quot;interview&quot; dbtype=&quot;ODBC&quot;>
UPDATE interview
SET
ID = '#Form.ID#',
InitialIntdate = '#Form.InitialIntdate#',
InitialInt ='#Form.InitialInt#',
TechIntvDate ='#form.TechIntvDate#',
TechIntv = '#Form.TechIntv#',
PeerInterviewdate ='#Form.PeerInterviewdate#',
PeerInterview = '#Form.PeerInterview#',
MarkInterdate = '#Form.MarkInterdate#',
MarkInter ='#Form.MarkInter#',
ExtOfferdate ='#form.ExtOfferdate#',
CheckRef = '#Form.CheckRef#',
StartDate ='#Form.StartDate#',
Comments = '#Form.Comments#',
Where
ID=#FORM.ID#
</CFQUERY>
<!--- <h4>These Changes were made to the database</h4>
<cfoutput>
#Form.InitialIntdate# #Form.InitialInt# #form.TechIntvDate# #Form.TechIntv# #Form.PeerInterviewdate#

</cfoutput> --->
</html>

And This is the error:

Error Occurred While Processing Request
Error Diagnostic Information
ODBC Error Code = 37000 (Syntax error or access violation)


[Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE statement.



The error occurred while processing an element with a general identifier of (CFQUERY), occupying document position (8:1) to (8:60).


Date/Time: 03/21/01 07:11:19
Browser: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)
Remote Address: 127.0.0.1
HTTP Referer:
 
Hi pretty simple:

you query:
<!--- Update --->
<CFQUERY NAME=&quot;update&quot; DATASOURCE=&quot;interview&quot; dbtype=&quot;ODBC&quot;>
UPDATE interview
SET
ID = '#Form.ID#',
InitialIntdate = '#Form.InitialIntdate#',
InitialInt ='#Form.InitialInt#',
TechIntvDate ='#form.TechIntvDate#',
TechIntv = '#Form.TechIntv#',
PeerInterviewdate ='#Form.PeerInterviewdate#',
PeerInterview = '#Form.PeerInterview#',
MarkInterdate = '#Form.MarkInterdate#',
MarkInter ='#Form.MarkInter#',
ExtOfferdate ='#form.ExtOfferdate#',
CheckRef = '#Form.CheckRef#',
StartDate ='#Form.StartDate#',
Comments = '#Form.Comments#',
Where
ID=#FORM.ID#
</CFQUERY>

The Fixed one:
<!--- Update --->
<CFQUERY NAME=&quot;update&quot; DATASOURCE=&quot;interview&quot; dbtype=&quot;ODBC&quot;>
UPDATE interview
SET
ID = '#Form.ID#',
InitialIntdate = '#Form.InitialIntdate#',
InitialInt ='#Form.InitialInt#',
TechIntvDate ='#form.TechIntvDate#',
TechIntv = '#Form.TechIntv#',
PeerInterviewdate ='#Form.PeerInterviewdate#',
PeerInterview = '#Form.PeerInterview#',
MarkInterdate = '#Form.MarkInterdate#',
MarkInter ='#Form.MarkInter#',
ExtOfferdate ='#form.ExtOfferdate#',
CheckRef = '#Form.CheckRef#',
StartDate ='#Form.StartDate#',
Comments = '#Form.Comments#'
Where
ID=#FORM.ID#
</CFQUERY>

You had an extra &quot;,&quot; after this line: Comments = '#Form.Comments#' and since there is no more field after this line you must not put a comma.

Chris ;-)
 
I already removed the , the problem appears to be in the update statement, and using cfif and so on.
 
Hi,

Could you explain this a little more? Your update statement seems fine but you should check if all these fields are text fields since you are inserting them as text fields.

What do you mean that the problem appears to be in the update statement or when using CFIF? There is no CFIF in the code you pasted ;-)

Please post the code you think is wrong and also the error you get from Cold Fusion (dont forget to put the debug on so that we get all the details from the CF debugger).

Thx,
Chris ;-)
 
This is how we fixed it:

<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;>

<html>
<head>
<title>Update Candidates Information</title>
</head>
<!--- Update --->
<CFQUERY DATASOURCE=&quot;interview&quot; name=&quot;myupdate&quot;>
UPDATE interview
SET
InitialIntdate =
<cfif Form.InitialIntdate is ''>
null,
<cfelse>
'#form.InitialIntdate#',
</cfif>
InitialInt = '#Form.InitialInt#',
TechIntvDate =
<cfif Form.TechIntvDate is ''>
null,
<cfelse>
'#form.TechIntvDate#',
</cfif>
TechIntv = '#Form.TechIntv#',
PeerInterviewdate =
<cfif Form.PeerInterviewdate is ''>
null,
<cfelse>
'#form.PeerInterviewdate#',
</cfif>
PeerInterview = '#Form.PeerInterview#',
MarkInterdate =
<cfif Form.MarkInterdate is ''>
null,
<cfelse>
'#form.MarkInterdate#',
</cfif>
MarkInter = '#Form.MarkInter#',
ExtOfferdate =
<cfif Form.ExtOfferdate is ''>
null,
<cfelse>
'#form.ExtOfferdate#',
</cfif>
CheckRef = '#Form.CheckRef#',
StartDate =
<cfif Form.StartDate is ''>
null,
<cfelse>
'#Form.StartDate#',
</cfif>
Comments = '#Form.Comments#'
Where ID= #FORM.ID#

</CFQUERY>
<!--- <h4>These Changes were made to the database</h4>
<cfoutput>
#Form.InitialIntdate# #Form.InitialInt# #form.TechIntvDate# #Form.TechIntv# #Form.PeerInterviewdate#

</cfoutput> --->
<CFLOCATION URL=&quot;interview2.cfm&quot;>
</html>

You take out the form ID at the beginning of the under the set statement because your NOT updating the ID, just the rest of the information, and on the form page we put the dateformat so that the dd/mm/yyyy would appear correctly.

Thank You for your input, I do appreciate it
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top