cfquery

Updating multiple rows from a cfquery recordset

梦想的初衷 提交于 2019-12-11 23:27:20
问题 Is there a way to update multiple rows of data when the data coming in is from the result of a CFQuery? Currently this run <cfquery> multiple times. Is there a way to do it in one uqery operation? <cfloop query=loc.fixItems> <cfset loc.count++> <cfset var categoryName = loc.fixItems.categoryName> <cfquery> update items set code = <cfqueryparam value="#code#"> where id = <cfqueryparam value="#itemId#"> </cfquery> </cfloop> This can run multiple times and put a heavy load on the server. 回答1:

Ext JS Dependent combo box

女生的网名这么多〃 提交于 2019-12-11 20:44:36
问题 I am new to extJS, and trying to implement the following functionality: I have two select drop down menus, transformed using extJS. How can I make sure that if a value in one combo box is selected, the other value should be set back to some default value? Thanks. Edited: Code till now: Ext.onReady(function(){ var converted = new Ext.form.ComboBox({ typeAhead: true, triggerAction: 'all', transform:'id_Select1', width:600, forceSelection:true, emptyText:'Select' }); var convertedCdr = new Ext

Coldfusion: executing dynamic query containing cfqueryparam

ぐ巨炮叔叔 提交于 2019-12-11 07:01:19
问题 First, the code. I'm making a struct of queries: <cfset myQueryStruct = { qone = "select * from t1 where column = <cfqueryparam cfsqltype='cf_sql_varchar' value='#arguments.a1#'>", qtwo = "select * from t2 where column = <cfqueryparam cfsqltype='cf_sql_varchar' value='#arguments.a1#'>" }> I need to execute the queries dynamically like below: <cfquery name="qName" datasource="#dsn#"> #myQueryStruct[arguments.type]# </cfquery> But I am getting an error: Error Executing Database Query.

count total records for each user

风格不统一 提交于 2019-12-11 06:05:51
问题 I have this code that pulls all users with open requests. I need to show a total for each assigned buyer. <CFQUERY NAME="allbuyers" DATASOURCE="procuresource3"> SELECT * FROM allorders3 WHERE open = 'y' order by assignedbuyer </cfquery> <cfoutput query="allbuyers"> #assignedbuyer# #prn# </cfoutput> <cfoutput> Total: #allbuyers.RecordCount# </cfoutput> The output is all records. I need a total for each user. Something like this below: Christine - 301366 Christine - 300729 Christine - 300731

How to print all the result without using Results.columnname in ColdFusion

拜拜、爱过 提交于 2019-12-11 02:13:37
问题 How to print all the result without using Results.columnname in ColdFusion for ex:- I have <cfquery name="getProductId"> select productId from product </cfquery> In Product Table i have 2 columns with product_name and Product_id. How can I print them without using getProductId.product_name getProductId.Product_id Thanks, 回答1: What are you trying to achieve? If you are looking for a way to computationally output query results based on a query whose column names you do not know, such as...

How can I perform a SQL SELECT with a LIKE condition for a string containing an open bracket character?

为君一笑 提交于 2019-12-10 16:56:37
问题 I have a simple search query: <cfquery name="_qSearch" dbtype="Query"> SELECT * FROM MyQoQ WHERE DESCRIPTION LIKE '%#URL.searchString#%' </cfquery> This query works excellently for most values. However, if someone searches for a value like "xxx[en" , it bombs with the error message The pattern of the LIKE conditional is malformed. . Is there any way around this, since the bracket has a special use in CFQUERY? 回答1: QoQ shares a feature of TSQL (MS SQL Server) whereby it's not just % and _ that

Creating nested <ul> tree structure from ParentID's in a db

戏子无情 提交于 2019-12-07 21:05:55
问题 This seems like a pretty common task I want to do, but I can't wrap my head around the cfloops and cfqueries. I have a database full of photo galleries. They all have an ID and a ParentID (except the root galleries - their ParentID is blank), and they can go multiple levels deep. Here's an example of the gallery structure: 1 1-1 1-2 2 2-1 2-1-1 2-1-2 2-2 I want to automatically output this structure above into nested ul's and li's (just like above). How is that done? I can't wrap my head

How do you use cfqueryparam in the ORDER BY clause?

回眸只為那壹抹淺笑 提交于 2019-12-07 00:22:51
问题 I'm trying to be a good CF web developer and use <cfqueryparam> around all FORM or URL elements that make it to my SQL queries. In this case, I'm trying to allow a user to control the ORDER BY clause dynamically. <cfquery datasource="MyDSN" name="qIncidents"> SELECT IncidentID, AnimalID, IntakeDate, DxDate, OutcomeDate FROM Incidents WHERE ShelterID = <cfqueryparam cfsqltype="cf_sql_integer" value="#Arguments.ShelterID#"> ORDER BY <cfqueryparam cfsqltype="cf_sql_varchar" value="#SortBy#"> <

Creating nested <ul> tree structure from ParentID's in a db

微笑、不失礼 提交于 2019-12-06 11:26:04
This seems like a pretty common task I want to do, but I can't wrap my head around the cfloops and cfqueries. I have a database full of photo galleries. They all have an ID and a ParentID (except the root galleries - their ParentID is blank), and they can go multiple levels deep. Here's an example of the gallery structure: 1 1-1 1-2 2 2-1 2-1-1 2-1-2 2-2 I want to automatically output this structure above into nested ul's and li's (just like above). How is that done? I can't wrap my head around the placement of the ul's and li's to display the hierarchy levels correctly. I guess the simpliest

How do you use cfqueryparam in the ORDER BY clause?

北慕城南 提交于 2019-12-05 04:33:10
I'm trying to be a good CF web developer and use <cfqueryparam> around all FORM or URL elements that make it to my SQL queries. In this case, I'm trying to allow a user to control the ORDER BY clause dynamically. <cfquery datasource="MyDSN" name="qIncidents"> SELECT IncidentID, AnimalID, IntakeDate, DxDate, OutcomeDate FROM Incidents WHERE ShelterID = <cfqueryparam cfsqltype="cf_sql_integer" value="#Arguments.ShelterID#"> ORDER BY <cfqueryparam cfsqltype="cf_sql_varchar" value="#SortBy#"> </cfquery> When I do this, I get the following error: The SELECT item identified by the ORDER BY number 1