URGENT HELP !!!!! Calculation problem in Order fo

# Thread: URGENT HELP !!!!! Calculation problem in Order fo

1. Laththa.S Guest

## URGENT HELP !!!!! Calculation problem in Order fo

I&#039m getting quantity as 0. How should i refer to the value in the Quantity text box and how can i update the value of total price each time user change the quantity????<BR><BR><BR>&#060;%<BR>Dim oConn<BR>Dim strTitle<BR><BR>strTitle = Request.QueryString("Title")<BR><BR>Set oConn=Server.CreateObject("ADODB.Connection")<BR>o Conn.Open "DSN=cnnCatalogue"<BR><BR>Dim strRS2<BR>Set strRS2=Server.CreateObject("ADODB.recordset")<BR>< BR>SQL_Query = "SELECT * "<BR>SQL_Query = SQL_Query & "FROM Books, Country "<BR>SQL_Query = SQL_Query & "WHERE (Books.HomeCountry = &#039MSIA&#039 AND Country.RegionID = &#039MSIA&#039 AND "<BR>SQL_Query = SQL_Query & "Books.Title =&#039" & strTitle &"&#039)"<BR>strRS2.Open SQL_Query, oConn<BR><BR>strBookPrice = (strRS2("MsiaPrice"))<BR><BR><BR>%&#062;<BR><BR><B R>&#060;BLOCKQUOTE&#062;<BR><BR><BR>&#060;TABLE border=1&#062;<BR>&#060;tr&#062;<BR>&#060;td&#062; &#060;b&#062;<BR>&#060;font face=&#039Arial&#039 color=#000080&#062;Quantity<BR>&#060;/font&#062;<BR>&#060;/b&#062;&#060;/td&#062;<BR><BR>&#060;td&#062;&#060;b&#062;<BR>&#0 60;font face=&#039Arial&#039 color=#000080&#062;Book Title<BR>&#060;/font&#062;<BR>&#060;/b&#062;&#060;/td&#062;<BR><BR>&#060;td&#062;&#060;b&#062;<BR>&#0 60;font face=&#039Arial&#039 color=#000080&#062;Unit Price<BR>&#060;/font&#062;<BR>&#060;/b&#062;&#060;/td&#062;<BR><BR>&#060;td&#062;<BR>&#060;b&#062;&#0 60;CENTER&#062;&#060;font face=&#039Arial&#039 color=#000080&#062;Total Price<BR>&#060;/font&#062;<BR>&#060;/b&#062;&#060;/CENTER&#062;&#060;/td&#062;&#060;/tr&#062;<BR><BR>&#060;tr&#062;<BR>&#060;td&#062;&# 060;input size="4" name="Quantity" value="1"&#062;&#060;/td&#062;<BR>&#060;td&#062;&#060;input size="70" name="Title" value="&#060;%=Request.QueryString("Title")%&#062; "&#062;&#060;/td&#062;<BR><BR>&#060;td&#062;&#060;input size="10" name="Price" value="&#060;%=Response.Write(strRS2("DollarSign") )%&#062;&#060;%=Response.Write(strBookPrice)%&#062 ;"&#062;&#060;/td&#062;<BR><BR>&#060;%<BR>Dim strPrice<BR>Dim strQty<BR>Dim strtotalPtice<BR><BR><BR>strPrice=CCur(strBookPric e)<BR>strQty=Quantity<BR>strtotalPtice = strQty*strPrice<BR>%&#062;<BR>&#060;td&#062;&#060; b&#062;&#060;CENTER&#062;&#060;font face=&#039Arial&#039 color=#000080&#062;&#060;input size="10" name="totalPrice" value="&#060;%=Response.Write(strtotalPrice)%&#062 ;"&#062;&#060;/td&#062;<BR>&#060;/font&#062;&#060;/b&#062;&#060;/CENTER&#062;<BR><BR>&#060;/tr&#062;<BR>&#060;/TABLE&#062;

2. Ben Timby Guest

## RE: URGENT HELP !!!!! Calculation problem in Orde

First of all, you don&#039t need to do this:<BR><BR>&#060;%=Response.Write()%&#062; <BR><BR>it is redundant, just do:<BR><BR>&#060;%=VariableName%&#062;<BR><BR>you might try explicitly converting your quantity to an int before doing calculations:<BR><BR>strPrice=CCur(strBookPrice)<B R>strQty=CInt(Quantity)<BR>strtotalPrice = strQty * strPrice<BR><BR>HTH

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•