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

Error Executing Database Query - CreateODBCDateTime 1

Status
Not open for further replies.

grimwald

Instructor
Apr 22, 2001
4
GB
I have just started using CF and am having a problem with CreateODBDDateTime

I'm getting the following error message:

Error Executing Database Query.
[Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression ''{ts

'2007-09-12 22:27:44'}''.

The error occurred in C:\Inetpub\ line 17

15 : <cfquery datasource="#dsn#" name="register_user">
16 : INSERT INTO forum_users (userName, userFamily, userEmail, userPassword, userUUIDFlag, userFlagDate, userLevel)
17 : VALUES ('#userName#', '#userFamily#', '#userEmail#', '#userPassword#', '#IDFlag#', '#Stamp#', '#userLevel#')
18 : </cfquery>
19 :

and here is the code I'm using:

<cfquery datasource="#DSN#" name="find_user">
SELECT *
FROM forum_users
WHERE userName = '#userName#'
</cfquery>

<cfif find_user.RecordCount IS 0>
<cfparam name="userLevel" default="User">
<cfset IDFlag = CreateUUID()>
<cfset Stamp = #CreateODBCDateTime(Now())#>



<cfquery datasource="#dsn#" name="register_user">
INSERT INTO forum_users (userName, userFamily, userEmail, userPassword, userUUIDFlag, userFlagDate, userLevel)
VALUES ('#userName#', '#userFamily#', '#userEmail#', '#userPassword#', '#IDFlag#', '#Stamp#', '#userLevel#')
</cfquery>

could somebody please tell me where I might be going wrong.

many thanks in advance
 
The single quotes are what is causing the error. Remove them or use cfqueryparam

Notice there are no quotes around the CreateODBCDateTime

Code:
... '#IDFlag#', #CreateODBCDateTime(Now())#, '#userLevel#')

Btw, you don't need # signs here

Code:
<cfset Stamp = #CreateODBCDateTime(Now())#>

... do instead ...

<cfset Stamp = CreateODBCDateTime(Now())>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top