p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

proasp_codeclinic thread: Update Sql Statement Required


Message #1 by "Taher Moiyed" <asp_stuff@y...> on Wed, 5 Jun 2002 11:31:35
'oops mistake!
' not 
'sSQL = sSQLh + sSQLop + sSQLsep + sSQLcp + sSQLt
'but
 sSQL = sSQLh & sSQLop & sSQLsep & sSQLcp & sSQLt


sorry ;)
> 
'> try next:
'> -------------------------------------
f> unction strtoint(s,errnum)
 >  If IsNumeric(s) Then 
 >     strtoint=Int(s) 
 >  Else 
 >     strtoint=errnum
 >  end if
e> nd function

> sSQLh = "UPDATE fus_prod set "
s> SQLt = " WHERE itemcode   =  '" & Trim(Request("MM_recordId")) & "'"
s> SQLop = ""
s> SQLcp  = ""
s> SQLsep =""
o> ldprice = strtoint(Trim(Request("oldprice")),-1)
i> f oldprice<>-1 then sSQLop = "oldprice = "& oldprice

> curprice = strtoint(Trim(Request("price")) ,-1)
i> f curprice <>-1 then sSQLcp = "Price = "& oldprice

> if oldprice<>-1 and curprice<>-1 then sSQLsep = ", "

> sSQL = sSQLh + sSQLop + sSQLsep + sSQLcp + sSQLt

> '-------------------------------------------

  Return to Index