I'm letting users filter by specific columns, including ORDER BY... So I naturally <cfqueryparam>'d it and got this error:
Error Executing Database Query. [Macromedia][SQLServer JDBC Driver][SQLServer]The SELECT item identified by the ORDER BY number 1 contains a variable as part of the expression identifying a column position. Variables are only allowed when ordering by an expression referencing a column name. <cfquery name="getProducts" datasource="#APPLICATION.dsn#"> SELECT tblMusicProducts.musicprodID, tblMusicProducts.musicprodname, tblMusicProducts.musicprodprice, tblMusicProducts.musicprodimagethumb, tblMusicProdTypes_X.musicprodID, tblMusicProdTypes_X.musicprodtypeID, tblMusicProdTypes.musicprodtypeID, tblMusicProdTypes.musicprodtypename FROM tblMusicProducts, tblMusicProdTypes_X, tblMusicProdTypes WHERE tblMusicProdTypes.musicprodtypeID = <cfqueryparam cfsqltype="cf_sql_integer" value="#URL.TYPE#"> AND tblMusicProducts.musicprodID = tblMusicProdTypes_X.musicprodID AND tblMusicProdTypes.musicprodtypeID = tblMusicProdTypes_X.musicprodtypeID ORDER BY <cfqueryparam cfsqltype="cf_sql_varchar" value="#order#"> </cfquery> If I remove the cfqueryparam, it works fine. I guess it's doing this because I'm including ASC and DESC in the variable. I'm creating a statement IN a variable basically. What's the best practice for doing this. I'm obviously goin about it the wrong way. Thanks, Will ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Macromedia ColdFusion MX7 Upgrade to MX7 & experience time-saving features, more productivity. http://www.adobe.com/products/coldfusion Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:271446 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

