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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cfif statement

Status
Not open for further replies.

vixter

IS-IT--Management
Mar 25, 2004
1
US
I am trying to insert some data but before it insterts I've setup an cfif Isdefined(name_of_field) statement that checks to see if a box is checked, if the box is checked it goes out and populates a field but it is not working.Below is my code and the error message I get when trying to do this procedure.

<cfquery datasource=&quot;database&quot;>
INSERT INTO table
(TypeofCall, Problem, Solution, TypeofProblem,
AssignedTo, Status, UserID, date
<cfif IsDefined(&quot;start_of_ticket&quot;)>,start_of_ticket</cfif>)
VALUES
('#TypeofCall#', '#Problem#', '#Solution#', '#TypeofProblem#',
'#AssignedTo#', '#Status#', '#UserID#', #CreateODBCDateTime(Now())#
<cfif IsDefined(&quot;start_of_ticket&quot;)>, #CreateODBCDateTime(Now())#</cfif>)
</cfquery>




Error Diagnostic Information
ODBC Error Code = 37000 (Syntax error or access violation)


[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near the keyword 'VALUES'.



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


Date/Time: 08/18/00 13:37:16
Browser: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT; CNETHomeBuild051099; DigExt)
Remote Address: 164.67.121.130
HTTP Referer:
 
Everything LOOKS okay, but what I would do with this to pinpoint the problem is temporarily delete one column (name and value) from the statement until you pinpoint which column SQL Server is choking on. One thing you may want to check is your single quotes to ensure that number columns are not quoted and strings are....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top