Solved

Proper formatting/need for cfqueryparam w/CF_SQL_TIMESTAMP & TimeFormat

Posted on 2010-08-14
2
724 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

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…
I have a large data set and a SSIS package. How can I load this file in multi threading?
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

729 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