[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Proper formatting/need for cfqueryparam w/CF_SQL_TIMESTAMP & TimeFormat

Posted on 2010-08-14
2
Medium Priority
?
730 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 2000 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

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

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

What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Viewers will learn how the fundamental information of how to create a table.

656 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