|
Hi
i am still stuck with a simple "query update error"
and i cant find the fix.
the rest seems tp load perfect.
so here goes
Values:
productIDs= 1,10,11,12,13,31,33,34,35
FEATURED_10=1
FEATURED_12=1 FEATURED_33=1 FEATURED_35=1 SPECIAL_1=1
SPECIAL_11=1 SPECIAL_13=1 SPECIAL_35=1 HIDDENPROD_1=1 PRICE_1=2
PRICE_10=333 PRICE_11=7 PRICE_12=65 PRICE_13=213 PRICE_31=888 PRICE_33=7 PRICE_34=7 PRICE_35=6699 the code:
<cfif
isdefined("form.updateprice")>
<cfloop list="#Form.ProductIDs#" index="p"> <CFQUERY NAME="updateprice"
DATASOURCE="#prefs.dsn#">
UPDATE products set unitprice = #Form["price_#p#"]# , Featured=<cfif isDefined("Form.Featured_#p#")>1<cfelse>0</cfif> ,special=<cfif
isDefined("Form.special_#p#")>1<cfelse>0</cfif>
,hiddenprod=<cfif isDefined("Form.hiddenprod_#p#")>,hiddenprod=1<cfelse>0</cfif> WHERE productid = #p# </CFQUERY> </cfloop> </cfif> eror:
[Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE statement.
SQL = "UPDATE products set unitprice = 2 , Featured=0 ,special=1 ,hiddenprod=,hiddenprod=1 WHERE productid = 1" Kind Regards
Greg Stone PH: 0411 787 565 ----- Original Message -----
From: Whiterod, David (DTUP)
Sent: Wednesday, June 16, 2004 2:39 PM
Subject: [cfaussie] RE: NEW batch style update request Will this update SQL allow you to record the un-checking featured, special and hiddenprod boxes? I think you would need to set featured etc to 1 if the form field was defined and 0 otherwise. i.e. <cfif isDefined("Form.Featured_#p#")>, Featured=1</cfif> to , Featured=<cfif isDefined("Form.Featured_#p#")>1<cfelse>0</cfif> cheers David -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Wednesday, 16 June 2004 9:29 AM To: CFAussie Mailing List Subject: [cfaussie] RE: NEW batch style update request Hi steve. found your snipet and now i understand the method... very clever.. i did think of that idea just couldnt work out how to match up on the process page. now i know the trick... thank you now to get it working , i am getting a really basic error on the update query and cant seem to track where the problem might be. heres the update query <cfif isdefined("form.updateprice")> <cfloop list="#Form.ProductIDs#" index="p"> <CFQUERY NAME="updateprice" DATASOURCE="#prefs.dsn#"> UPDATE products set unitprice = #Form["price_#p#"]# <cfif isDefined("Form.Featured_#p#")>, Featured=1</cfif> <cfif isDefined("Form.special_#p#")>,special=1</cfif> <cfif isDefined("Form.hiddenprod_#p#")>,hiddenprod=1</cfif> WHERE productid = #p# </CFQUERY> </cfloop> </cfif> The error ODBC Error Code = 22005 (Error in assignment) [Mirosoft][ODBC Microsoft Access Driver] Data type mismatch in criteria _expression_. SQL = "UPDATE products set unitprice = 2.0 ,special=1 ,hiddenprod=1 WHERE productid = 1" Kind Regards Greg Stone PH: 0411 787 565 ----- Original Message ----- From: Steve Onnis To: CFAussie Mailing List Sent: Tuesday, June 15, 2004 5:49 PM Subject: [cfaussie] RE: NEW batch style update request Greg the code i sent would update it all at once, in the same update statement check back through it Steve -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of [EMAIL PROTECTED] Sent: Tuesday, June 15, 2004 5:23 PM To: CFAussie Mailing List Subject: [cfaussie] RE: NEW batch style update request Oppps. what did i miss. i got so confused on which one to work with and thought your snipet was the sweetest for the update price function. for the checkbox i came up with what i thought was a elegant solution. This was the most functional for price update ..YES or NO? <cfloop index="x" from="1" to="#listlen(form.productpartno)#" step="1"> <CFQUERY NAME="updateprice" DATASOURCE="#prefs.dsn#"> UPDATE products SET unitprice= #listgetat(form.price,x)# WHERE productpartno = '#listgetat(form.productpartno,x)#' </CFQUERY> </cfloop> as for the check boxes i cant think of a way to check if they are ticked or not. HMMMM it works...... but .... back to the drawing board or ....??? Kind Regards Greg Stone PH: 0411 787 565 ----- Original Message ----- From: Steve Onnis To: CFAussie Mailing List Sent: Tuesday, June 15, 2004 5:18 PM Subject: [cfaussie] RE: NEW batch style update request Sorry greg but thats sooooooooooooooooooooo yuk -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of [EMAIL PROTECTED] Sent: Tuesday, June 15, 2004 4:39 PM To: CFAussie Mailing List Subject: [cfaussie] RE: NEW batch style update request Hi for all those who contributed i settled on these updates. <!--- loop over selected fields and update table ---> <cfif isdefined("form.featured")> <cfloop index='item' list='#form.featured#' delimiters=','> <CFQUERY NAME="updatefeatured" datasource="#prefs.dsn#" > UPDATE products SET featured=1 WHERE (productid = '#item#') </CFQUERY> </cfloop> </cfif> <cfif isdefined("form.special")> <cfloop index='item' list='#form.special#' delimiters=','> <CFQUERY NAME="updatespecial" datasource="#prefs.dsn#" > UPDATE products SET special=1 WHERE (productid = '#item#') </CFQUERY> </cfloop> </cfif> <cfif isdefined("form.hiddenprod")> <cfloop index='item' list='#form.hiddenprod#' delimiters=','> <CFQUERY NAME="updatehiddenprod" DATASOURCE="#prefs.dsn#"> UPDATE products SET hiddenprod=1 WHERE (productid = '#item#') </CFQUERY> </cfloop> </cfif> <cfloop index="x" from="1" to="#listlen(form.productpartno)#" step="1"> <CFQUERY NAME="updateprice" DATASOURCE="#prefs.dsn#"> UPDATE products SET unitprice= #listgetat(form.price,x)# WHERE productpartno = '#listgetat(form.productpartno,x)#' </CFQUERY> </cfloop> regards greg ----- Original Message ----- From: Steve Onnis To: CFAussie Mailing List Sent: Tuesday, June 15, 2004 4:29 PM Subject: [cfaussie] RE: NEW batch style update request I would recommend against this method Not very efficient and your going to run into problems especially as your dealing with checkboxes aswell which unless they are checked wont get passed with your form and thus wont be available in your list, not to mention is i check one of the boxes, trying to work out which one actually got checked would be a nightmare Steve --- You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] Aussie Macromedia Developers: http://lists.daemon.com.au/ --- You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] Aussie Macromedia Developers: http://lists.daemon.com.au/ --- You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] Aussie Macromedia Developers: http://lists.daemon.com.au/ --- You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] Aussie Macromedia Developers: http://lists.daemon.com.au/ --- You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] Aussie Macromedia Developers: http://lists.daemon.com.au/ --- You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] Aussie Macromedia Developers: http://lists.daemon.com.au/ --- You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] Aussie Macromedia Developers: http://lists.daemon.com.au/ --- You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] Aussie Macromedia Developers: http://lists.daemon.com.au/ --- You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] Aussie Macromedia Developers: http://lists.daemon.com.au/ |
- [cfaussie] RE: NEW batch style update request Steve Onnis
- [cfaussie] RE: NEW batch style update request stone
- [cfaussie] RE: NEW batch style update request Steve Onnis
- [cfaussie] RE: NEW batch style update request stone
- [cfaussie] RE: NEW batch style update request Aaron DC
- [cfaussie] RE: NEW batch style update request Steve Onnis
- [cfaussie] RE: NEW batch style update request stone
- [cfaussie] RE: NEW batch style update request Clifton Steve
- [cfaussie] RE: NEW batch style update request stone
- [cfaussie] RE: NEW batch style update request Whiterod, David (DTUP)
- [cfaussie] RE: NEW batch style update request stone
- [cfaussie] RE: NEW batch style update request Justin Mclean
- [cfaussie] RE: NEW batch style update request stone
- [cfaussie] RE: NEW batch style update request Whiterod, David (DTUP)
- [cfaussie] RE: NEW batch style update request Justin Mclean
- [cfaussie] RE: NEW batch style update request Steve Onnis
- [cfaussie] RE: NEW batch style update request stone
- [cfaussie] RE: NEW batch style update request TRACEY, Darren
- [cfaussie] RE: NEW batch style update request Justin Mclean
