Pages

Wednesday, May 14, 2014

comparing ms sql date with coldfusion date

comparing ms sql date with coldfusion date


if you use cfsqltype as "cf_sql_date" when you compare date with function CreateODBCDateTime then it will not match so use this data type "cf_sql_timestamp"



Error code: 
and SupplyDate =  <CFQUERYPARAM cfsqltype="cf_sql_date" Value="#CreateODBCDateTime(local.ctrArrSMThisSupplyDetailsSupplyDates.SupplyDate)#">



fixed code: 
and SupplyDate =  <CFQUERYPARAM cfsqltype="cf_sql_timestamp" Value="#CreateODBCDateTime(local.ctrArrSMThisSupplyDetailsSupplyDates.SupplyDate)#">

Wednesday, April 30, 2014

Entity has incorrect type for being called as a function coldfusion

Entity has incorrect type for being called as a function coldfusion

 may be you have some variable name and function name same.

Example code-

<cfset  fgGetMeyourName = fgGetMeyourName (1)>

<cffunction name ="fgGetMeyourName">
        <cfargument name="id" >
        <!--- do ur code -->

</cffunction>

in above example- fgGetMeyourName is variable and function name both. this will give error.

FIX: your function name and variable name needs to be different. 


Thursday, January 23, 2014

populating a table from cfquery result

 this is how you can insert into a table from cfquery resultset.

many insert cfquery will be a bad idea. this is also not a very efficient way but kind of okay.  best thing you can do is to prepare a xml set and insert through  a stored proc through xml insert.

this is easy to do in cf.
1. your query is "qryCodeValue"

<cfsavecontent variable="qryTorun">                     
                    INSERT INTO table (ListNumber,listvalue) VALUES
                    <cfoutput query="qryCodeValue">                                          
                        (#qryCodeValue.ListNumber#, '#qryCodeValue.codevalue#)
                    <cfif qryCodeValue.currentRow EQ qryCodeValue.recordCount>;<cfelse>,</cfif>
                    </cfoutput>
</cfsavecontent>

 <cfquery name="qryRunInsertVar" datasource="#yourDS#">                                                               
              #REReplace(qryTorun,"''","'","ALL")#                          
 </cfquery>