Pages

Monday, January 5, 2015

[Macromedia][SQLServer JDBC Driver][SQLServer]Transaction (Process ID 80) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.


Coldfusion 

ErrorCode1205

Deadlock Transaction because of cftransaction. 

Error is:
[Macromedia][SQLServer JDBC Driver][SQLServer]Transaction (Process ID 80) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.

java.sql.SQLTransactionRollbackException: [Macromedia][SQLServer JDBC Driver][SQLServer]Transaction (Process ID 80) was deadlocked on lock resources with another process and has been chosen as the deadlock victim.



<cfquery name="qryGetLastID" datasource="#variables.Pub_DS#">
      SET NOCOUNT ON

      insert into table
      (column1,datecreated,createdby)
      values(1,2,3)

      SELECT @@Identity AS maxID
      SET NOCOUNT OF
</cfquery>

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>


Wednesday, September 25, 2013

red text in viewsource in firefox / why code is in red in firefox view source

 
 
 
if you wonder why you see red text in view source in firefox.   
 
 
<b><u><font size="2">EN </u></b></font> 
 
refer above example. 
 

here is the reason. 
there must be wrong with its start/end tag, missing double quote, missing single quote
or wrong  opening or closing of tag. 
 
in above example you can see i m closing font at last but i 
should close  it immediately after  text "EN".

Saturday, September 21, 2013

adding a blank value in a list

some times we need to add a blank value in a list. 


just as a note blank value will not be added if you are not adding a space in it



code 1 :     <cfset lstBOtitle = listappend(lstBOtitle,"",",")/>   -- will not work

code 2:     <cfset lstBOtitle = listappend(lstBOtitle," ",",")/>   -- will work
(above code has a space in it )




Thursday, March 28, 2013

showing /r/n for carriage returns and new line in ColdFusion Builder

showing whitespace in coldfusion Builder as r n

this is very common that some time while writing our code in coldfusion builder we press CTRL + period key (.) and coldfusion builder starts showing while space, carriage return as \r \n and you start feeling kind of :( .

simply toggle with pressing CTRL + . (period key) and it will be okay.