<cffunction access="public" name="qry_cart_check_item_quantities" output="no" returntype="query" hint="Verifies that items in user's cart are still available."> <cfargument name="cf_user_id" type="string" required="no" default=""> <cfargument name="app_user_id" type="numeric" required="no" default="0"> <cfif not len(arguments.cf_user_id) and arguments.app_user_id eq 0> <cfabort showerror="qry_cart_check_item_quantities: you must pass either arguments.cf_user_id or arguments.app_user_id"> </cfif> <!--- <cfdump var="#arguments.cf_user_id#"> <cfdump var="#arguments.app_user_id#"><cfabort> ---> <cfquery name="qry_cart_check_item_quantities" datasource="#request.dataSource#"> exec [proc_rhkprod_cart_check_item_quantities] <cfif len(arguments.cf_user_id)> @cf_user_id = <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#arguments.cf_user_id#"> <cfelse> @cf_user_id = <cfqueryparam value="#arguments.cf_user_id#" cfsqltype="CF_SQL_VARCHAR" null="yes"> </cfif> , <cfif arguments.app_user_id neq 0> @app_user_id = <cfqueryparam cfsqltype="CF_SQL_INTEGER" value="#arguments.app_user_id#"> <cfelse> @app_user_id = <cfqueryparam value="#arguments.app_user_id#" cfsqltype="CF_SQL_INTEGER" null="yes"> </cfif> </cfquery> <cfreturn qry_cart_check_item_quantities> </cffunction>
On Wed, Apr 7, 2010 at 4:27 PM, Judah McAuley <[email protected]> wrote: > > It looks to me like your CF app is sending in 1506_18149772 as > app_user_id somewhere. Are you using cfstoredproc and > cfstoredprocparam or are you doing this via cfquery? > > Judah > > On Wed, Apr 7, 2010 at 1:20 PM, Matthew Smith <[email protected]> > wrote: > > > > That is running it in MS. > > > > Here is the beginning of the proc. The rest of the vars are internal, > not > > passed in: > > > > ALTER PROCEDURE [dbo].[proc_rhkprod_cart_check_item_quantities] > > @cf_user_id varchar(1000) = null > > ,@app_user_id int = null > > WITH > > EXECUTE AS CALLER > > AS > > BEGIN > > SET NOCOUNT ON; > > > > DECLARE @tablePK INT > > ,@tblProductsFK INT > > ,@cartQuantity INT > > ,@UorLorUL varchar(2) > > ,@quantity INT > > ,@release BIT > > ,@itemNotFound BIT > > ,@removeFlag BIT > > ,@updateFlag BIT > > > > On Wed, Apr 7, 2010 at 1:43 PM, Medic <[email protected]> wrote: > > > >> > >> And have you tried running this in management studio and filling in the > var > >> values? > >> > >> > >> > >> On Wed, Apr 7, 2010 at 3:39 PM, Medic <[email protected]> wrote: > >> > >> > What about all the rest of the vars? > >> > > >> > > >> > > >> > > >> > On Wed, Apr 7, 2010 at 3:28 PM, Matthew Smith <[email protected] > >> >wrote: > >> > > >> >> > >> >> exec [proc_rhkprod_cart_check_item_quantities] @cf_user_id = > >> >> '1506_18149772'; > >> >> > >> >> On Wed, Apr 7, 2010 at 8:40 AM, Medic <[email protected]> wrote: > >> >> > >> >> > > >> >> > Can you also post an example or two of exactly what data you might > be > >> >> > passing into the sp? > >> >> > Do you ever pass in zero length strings or nulls into the sp for > both > >> >> > values? > >> >> > > >> >> > On Wed, Apr 7, 2010 at 10:04 AM, Matthew Smith < > [email protected] > >> >> > >wrote: > >> >> > > >> >> > > > >> >> > > Yes, I understand that. > >> >> > > > >> >> > > I'm just trying to understand why it is trying to cast it as an > int. > >> >> Is > >> >> > it > >> >> > > something that the COALESCE or NULLIF does automatically? Is it > >> >> looking > >> >> > at > >> >> > > the first argument and casting the second as the same datatype? > I > >> >> don't > >> >> > > think it is becuase if I switch the two around I get the same > error. > >> >> > > > >> >> > > > >> >> > > On Wed, Apr 7, 2010 at 5:34 AM, Medic <[email protected]> > wrote: > >> >> > > > >> >> > > > > >> >> > > > You wouldn't be able to cast the cf_user_id as an int since > it's > >> got > >> >> a > >> >> > > > nasty > >> >> > > > little underscore in it. Why not go the other route and cast > >> >> > app_user_id > >> >> > > as > >> >> > > > a varchar since you're only looking to see if it's null. > >> >> > > > > >> >> > > > On Tue, Apr 6, 2010 at 10:28 PM, Matthew Smith < > >> >> [email protected] > >> >> > > > >wrote: > >> >> > > > > >> >> > > > > > >> >> > > > > INSERT INTO rhkprod_tblCartAdjustments ( > >> >> > > > > tblPeopleFK > >> >> > > > > ,cfUserID > >> >> > > > > ,tblProductsFK > >> >> > > > > ,adjusted > >> >> > > > > ,originalQuantity > >> >> > > > > ,adjustedQuantity > >> >> > > > > ) > >> >> > > > > SELECT NULLIF(@app_user_id, '') > >> >> > > > > ,NULLIF(@cf_user_id, '') > >> >> > > > > ,@tblProductsFK > >> >> > > > > ,1 > >> >> > > > > ,@cartQuantity > >> >> > > > > ,@quantity > >> >> > > > > WHERE COALESCE(NULLIF(@app_user_id, ''), > NULLIF(@cf_user_id, > >> >> '')) > >> >> > IS > >> >> > > > NOT > >> >> > > > > NULL > >> >> > > > > > >> >> > > > > I am getting: > >> >> > > > > Error Executing Database Query. [Macromedia][SQLServer JDBC > >> >> > > > > Driver][SQLServer]Conversion failed when converting the > varchar > >> >> value > >> >> > > > > '1506_18149772' to data type int. > >> >> > > > > > >> >> > > > > If I comment out the following: > >> >> > > > > > >> >> > > > > WHERE COALESCE(NULLIF(@app_user_id, ''), > NULLIF(@cf_user_id, > >> >> '')) > >> >> > IS > >> >> > > > NOT > >> >> > > > > NULL > >> >> > > > > > >> >> > > > > It works. > >> >> > > > > > >> >> > > > > @app_user_id is an int, @cf_user_id is a varchar. Is there > some > >> >> sort > >> >> > > of > >> >> > > > > conversion going on? Can I cast or convert the @cf_user_id > to > >> an > >> >> int > >> >> > > > > somehow? I don't need the value, just need to know that it > is > >> not > >> >> > > null. > >> >> > > > > > >> >> > > > > > >> >> > > > > > >> >> > > > > >> >> > > > > >> >> > > > >> >> > > > >> >> > > >> >> > > >> >> > >> >> > >> > >> > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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-community/message.cfm/messageid:315243 Subscription: http://www.houseoffusion.com/groups/cf-community/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-community/unsubscribe.cfm
