Copy link to clipboard
Copied
Anyone know how to fix this problem?
This works...
<cfquery name="deleteNote" datasource="notes">
SELE
</cfquery>
<cfoutput query="deleteNote">Deleted note...</cfoutput>
The query works but an error message appears on the screen...
<cfquery name="deleteNote" datasource="notes">
DELETE FROM tblNotes
</cfquery>
<cfoutput query="deleteNote">Deleted note...</cfoutput>
Attribute validation error for tag cfoutput. | |
The value of the attribute query, which is currently deleteNote, is invalid. | |
The error occurred in C:\Inetpub\wwwroot\cf\notes2.cfm: line 20 | |
18 : 19 : 20 : <cfoutput query="deleteNote"></cfoutput> |
Copy link to clipboard
Copied
You can only output select queries.
Copy link to clipboard
Copied
Thank you. That guided me to my answer. I was under the impression that CFQUERY tags were not executed until they were called by a CFOUTPUT, but I realize my error now.
Copy link to clipboard
Copied
<cfquery name="deleteNote" datasource="notes">
DELETE FROM tblNotes
</cfquery>
<cfoutput query="deleteNote">Deleted
note...</cfoutput>
1. DELETE queries do not typically return results. So what information are you trying to display in the cfoutput?
2. Both cfquery's have the same name. So if you are attempting to use both in the same page, the second query (ie DELETE) will overwrite the results of first. Resulting in an error when you try and output the results, because there are none for DELETE statements.
If you wish to preserve the results of first SELECT query, give the cfquery's different names:
... #Columns# ....
</cfoutput