Ask a Question related to Coldfusion Database Access, Design and Development.
-
Battle #1
Syntax error in Where Statement
Having a problem with what the server says is a syntax error in the Where
statement, but cant figure out where it is.
<cfif IsDefined('URL.RecordID') OR IsDefined('Form.RecordID')>
<cfif IsDefined('URL.RecordID')>
<cfset RecordID=URL.RecordID>
<cfelse>
<cfset RecordID=Form.RecordID>
</cfif>
<cfelse>
<cfabort showerror="The RecordID must be passed to this template">
</cfif>
<cfif IsDefined('Form.RULES_Delete')>
<cfquery name="DeleteRecord" datasource="#Request.databaseA#" dbtype="ODBC">
DELETE FROM RULESID
WHERE ID=#variables.RecordID#
</cfquery>
<cfset Deleted=true>
</cfif>
<!--- inserted this into code to see if that changed the date to follow
fomat --->
<cfset DATE='#DateFormat("#Now()#", "mm/dd/yyyy")# #TimeFormat("#Now()#",
'hh:mm:sstt')#'>
<cfif IsDefined('Form.RULES_Edit')>
<cfquery name="UpdateRecord" datasource="#request.databaseA#" dbtype="ODBC">
UPDATE RULES
SET
NAME='#Form.NAME#',TEXT='#Form.TEXT#',EDITOR='#For m.EDITOR#',EDITOR_EMAIL='#Form
..EDITOR_EMAIL#',DATE='#Form.DATE#'
WHERE ID=#form.variables.RecordID# <---- is where the error occurs
</cfquery>
<cfset Updated=true>
</cfif>
<CFQUERY name="GetRecord" dataSource="mw4off" maxRows=1>
SELECT *
FROM RULES
WHERE ID = #variables.RecordID#
</CFQUERY>
Any help would be appreciated here.
Running windows 2003 server sp1 and Coldfusion Mx 7 server
Thanks
Battle Guest
-
Syntax error in UPDATE statement.
ok i have an update form that i created it is for the admin of the site to add/edit user account info for memebers to login. the form adds or edits... -
Syntax error in INSERT INTO statement
I have a two table setup in fact I am doing the blog tutorial on Macromedia but with Access and asp I have two tables topic and articles I have a... -
Syntax Error Update Statement
Can someone tell me what's wrong with this code? I need help. Thanks! It is an update page. FIRST PAGE: LOGIN CHECK <!--- Filename: ... -
syntax error in replace statement
What's wrong with this code? strLongDesc = Replace(Replace(Replace(Replace(Trim(Request.Form("LongDesc")),"'","''"),vbC... -
Syntax Error In Update Statement
I'm having a problem getting one piece of code to work on my app. It's a simple password change. For some reason, I've been getting the following... -
Battle #2
Re: Syntax error in Where Statement
ok in the where statement above, the code should read
WHERE ID=#variables.RedordID#
Battle Guest
-
MikerRoo #3
Re: Syntax error in Where Statement
Try the attached code.
<cfif IsDefined('URL.RecordID') OR IsDefined('Form.RecordID')>
<cfif IsDefined('URL.RecordID')>
<cfset RecordID = Trim (URL.RecordID)>
<cfelse>
<cfset RecordID = Trim (Form.RecordID)>
</cfif>
<cfelse>
<cfabort showerror="The RecordID must be passed to this template">
</cfif>
<cfif IsDefined('Form.RULES_Delete')>
<cfquery name="DeleteRecord" datasource="#Request.databaseA#"
dbtype="ODBC">
DELETE FROM RULESID
WHERE ID=#variables.RecordID#
</cfquery>
<cfset Deleted=true>
</cfif>
<!--- inserted this into code to see if that changed the date to follow fomat
--->
<cfset DATE='#DateFormat("#Now()#", "mm/dd/yyyy")# #TimeFormat("#Now()#",
'hh:mm:sstt')#'>
<cfif IsDefined('Form.RULES_Edit')>
<cfquery name="UpdateRecord" datasource="#request.databaseA#"
dbtype="ODBC">
UPDATE
RULES
SET
NAME ='#Form.NAME#', <!--- "Text" will not scale!
Rename the column. --->
[TEXT] ='#Form.TEXT#', <!--- "Text" will not scale!
Rename the column. --->
EDITOR ='#Form.EDITOR#',
EDITOR_EMAIL ='#Form.EDITOR_EMAIL#',
<!--- XXXXXX Is Date stored as text or datetime?!?
Use the appropriate set statement.
[DATE] ='#Form.DATE#' <!--- "Date" is a reserve word!!
Rename the column. --->
--->
[DATE] =#CreateODBCDate (Trim (Form.DATE))#'
WHERE
ID=#variables.RecordID#
</cfquery>
<cfset Updated=true>
</cfif>
<CFQUERY name="GetRecord" dataSource="mw4off" maxRows=1>
SELECT *
FROM RULES
WHERE ID = #variables.RecordID#
</CFQUERY>
MikerRoo Guest



Reply With Quote

