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

cfqueryparam syntax issue

Status
Not open for further replies.

Klyphq

Technical User
Jan 28, 2011
4
CA
I am using bluedragon.net 6.2.
I am having problems with Gridmonger 3.20

what I want to do is pass a date (stored on form as string) into my acess database.

Code - that is not working
<cfqueryparam
cfsqltype=#variables.SType#
Value="#DateFormat(#Evaluate(ListGetAt(FormFields,variables.LoopCounter))#,"yyyy-mm-dd" )#">

thanks
 
Problem occurred while parsing, "#DateFormat(#Evaluate(ListGetAt(FormFields,variables.LoopCounter))#,"yyyy-mm-dd" )#"

OR, sometimes I get [2011-01-05] is not a number.
with the expression

<cfqueryparam
cfsqltype=#variables.SType#
value="#DateFormat(Evaluate(ListGetAt(FormFields,variables.LoopCounter)),"yyyy-mm-dd" )#">


sorry for not including this earlier.
 
It is hard to diagnose without knowing the actual values used. It could be a wrong value, wrong cfsqltype or a combination of both. When the error occurs, what is the actual cfsqltype and value you are using? ie The result of Evaluate(ListGetAt(FormFields,variables.LoopCounter))

Evaluate(ListGetAt(FormFields,variables.LoopCounter))
BTW: What is the reason for using evaluate()?

----------------------------------
 
This should be a string "2011-01-05".

The form variable @ (FormFeilds,variables.LoopCounter) is a date string determined using a callender lookup.

--

The history of the issue is that I used to use the statement
<cfqueryparam
cfsqltype=#variables.SType#
Value=#Evaluate(ListGetAt(FormFields,variables.LoopCounter))#>

but that returned an error of [2011-05-01] is not a number.
I had assumend that the problem was trying to puch a string into a date feild.

I went through the database & all code to change the date format to yyyy-mm-dd. then I added the following decision
<cfif "#ListGetAt(variables.FieldCFQPType,variables.LoopCounter)#" NEQ "6">
[Where the feild type of "6" is defined as a Date Feild.]
and now I am still trying to get the code to push to the dataabse clean.


 
database & all code to change the date format to yyyy-mm-dd.

Assuming the data type of the target column is date/time, the format does not matter. Databases do not store date/time values as formatted strings. You just need to pass in a date/time object.

But you still did not say what the actual values are when the error occurs. For all we know, the code could be using a cfsqltype of "cf_sql_numeric" and a value of "widget".

<cfquerparam
cfsqltype="????"
value="??????">


----------------------------------
 
the data type is CD_SQL_DATE.


Though with further research it appears that the probelm I'm having is inherrant to access & passing date strings.

the base application I am using is Gridmonger 3.20. Apparently in 3.30 that was one of the big fixes was to re-write the calls to eliminate the cfqueryparam.

thanks for the help.
 
Honestly, I do not use MS Access beyond occasional tests. But I have never had problems inserting dates with cfqueryparam and type cf_sql_timestamp. Though I much prefer using cfqueryparam, createODBCDate and createODBCDateTime functions work as well.

----------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top