Could it be that one (or more) of the rows in column reOrder is of type Double while the other rows are all of type string? I am guessing maybe you want a numeric value in this row but one of more rows got empty.
On Tue, Jan 12, 2010 at 1:34 PM, Chad Gray <[email protected]> wrote: > > While I am looking over Roberts code that he sent me why would I get a > casting error for this code? I take the ORDER BY statement out of the Query > of a Query and it does not error. > > Error casting an object of type java.lang.Double cannot be cast to > java.lang.String to an incompatible type. > > <cfset QueryAddColumn(getColors, "reOrder", "integer", reOrderArray)> > > <cfquery dbtype="query" name="newOrder"> > SELECT ColorName > FROM getColors > ORDER BY reOrder > </cfquery> > > > > > > -----Original Message----- > > From: Chad Gray [mailto:[email protected]] > > Sent: Tuesday, January 12, 2010 12:55 PM > > To: cf-talk > > Subject: reorder a query > > > > > > I am thinking there has to be an easier way to do this then what I > > currently have. > > > > I need to move a row in a Query object up or down. Like imagine a page > > with little arrows on each record and you want record 2 to move to the > > position of record 1 and move record one to the position of record 2. > > > > Then I want to delete the records from the table and insert the newly > > ordered records back into the database. > > > > The direction I am currently going is to loop over the query object find > > the records that needs moved and start creating an Array for the new > order > > 2,1,3,4 etc. > > > > Then use QueryAddColumn(getColors, "reOrder", "integer", reOrderArray) to > > insert the array into my query object. > > > > Then user a Query of a Query to do a > > SELECT * > > FROM getColors > > ORDER BY reorder > > > > Then delete the records and loop over the query object to insert back > into > > the table. > > > > Seems really overly complicated... Can anyone think of a better way? > > > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:329579 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

