Posts
Showing posts from December, 2013
How to parse JSON in coldfusion
- Get link
- X
- Other Apps
Parses the json object and displays the contents of its arrays using DeserializeJSON, This function is useful any time a ColdFusion page receives data as JSON strings. I Type Json: <cfoutput> <cfset JsonData='[{"reason": "email address is unknown", "email": "abc@hotmail.comh"}, {"reason": "email address is unknown", "email": "bbc@68gmail.com"}, {"reason": "email address is unknown", "email": "ff@ff.com"}, {"reason": "Known bad domain", "email": "rr@hotmai.com"}, {"reason": "email address is unknown", "email": "ll@pp.rr.com"}]'> <cfset JsonData=REReplace(JsonData,"^\s*[[:word:]]*\s*\(\s*","")> <cfset JsonData=REReplace(JsonData, "\s*\)\s*$", "")> <cfset cfData=DeserializeJ...
Insert multiple rows at a time in database
- Get link
- X
- Other Apps
We can insert multiple rows in data using one query.It reduce the number of times execute requests. I Type : <Cfquery name="InsertReportDetails" datasource="TestDB"> INSERT INTO UserReporting(UserId,BatchId, ReportId) SELECT #session.UserID#,2,1 UNION SELECT #session.UserID#,2,2 UNION SELECT #session.UserID#,2,3 UNION SELECT #session.UserID#,2,4 </Cfquery> II Type : <Cfquery name="InsertReportDetails" datasource="TestDB"> INSERT INTO UserReporting(UserId,BatchId, ReportId) VALUES (#session.UserI...