Solved

Proper formatting/need for cfqueryparam w/CF_SQL_TIMESTAMP & TimeFormat

Posted on 2010-08-14
2
721 Views
Last Modified: 2012-06-27

I am getting the following error:


The error occurred in E:\CustomerData\webspaces\webspace_00104265\wwwroot\modules\q_event.cfm: line 812
Called from E:\CustomerData\webspaces\webspace_00104265\wwwroot\modules\q_event.cfm: line 798
Called from E:\CustomerData\webspaces\webspace_00104265\wwwroot\modules\q_event.cfm: line 739
Called from E:\CustomerData\webspaces\webspace_00104265\wwwroot\modules\q_event.cfm: line 134
Called from E:\CustomerData\webspaces\webspace_00104265\wwwroot\modules\q_event.cfm: line 1
810 : <cfqueryparam cfsqltype="cf_sql_integer" value="#posted_by#">,
811 : <cfqueryparam cfsqltype="CF_SQL_TIMESTAMP" value="#dateformat(now(), 'mm/dd/yyyy')#">,
812 : <cfqueryparam cfsqltype="CF_SQL_TIMESTAMP" value="#TimeFormat(Now(), 'hh:mm tt')#">)
813 : SELECT @@Identity AS MusicID
814 :



do I even need to be using the cfqueryparam?

The dateformat(now() seems to be working but not the TimeFormat(Now()

0
Comment
Question by:btintermedia
2 Comments
 
LVL 52

Accepted Solution

by:
_agx_ earned 500 total points
ID: 33439296
Can you post the whole query and the error message? That snippet just shows some sort of error occurred. But not what the error is.

>> do I even need to be using the cfqueryparam?

   Technically, no. But it's a good practice for several reasons: performance, security and
   correct interpretation of date values.

>>  SELECT @@Identity AS MusicID

    For CF8+ it's better to use cfquery's result attribute to get the new ID. For other versions
    SCOPE_IDENTITY() is probably what you want instead.  @@Identity can return the wrong
    value under certain conditions.
    http://msdn.microsoft.com/en-us/library/ms190315.aspx
0
 

Author Closing Comment

by:btintermedia
ID: 33462119
I determined that I was passing a wrong variable, farther back in application - but I had forgotten that I had not upgraded this code to the correct standard in terms of getting the new recordset that is generated, so I am awarding points.

thanks for you help
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question