Calculations and ASP

Results 1 to 3 of 3

Thread: Calculations and ASP

  1. #1
    Join Date
    Dec 1969

    Default Calculations and ASP

    I have a form, the user enters information, The action of the form is posting to itself. on submit I must use this information to query our database for rates. I then want to use those rate to calculate an insurance amount. Can I use a calculation within ASP?? <BR><BR>Here is our code:(note the line of code referencing sResult10)<BR><BR>&#060;%@LANGUAGE="VBSCRIPT"%&#06 2;<BR><BR><BR> &#060;%<BR> DataSource = "DSN=Cliac"<BR> Set con = Server.CreateObject("ADODB.Connection")<BR> con.Open DataSource<BR> Set rs = Server.createObject("ADODB.RecordSet")<BR> &#039;sAge = "10" <BR> sAge = Request("txtYears")<BR> sAmt = request("txtInsAmt")<BR> &#039;Response.write sAge <BR> &#039;look at page 328 in asp book<BR> <BR> sSelect = "Select rate, year from tblRates where Age = &#039;40&#039; and sex = &#039;F&#039; order by year"<BR> <BR> sSelect, DataSource<BR><BR> <BR> IF Not rs.BOF or Not rs.EOF Then<BR> rs.MoveFirst<BR> Do While Not rs.EOF<BR> Select Case rs("year")<BR> Case 10<BR> sRate10 = rs("Rate")<BR>**** this is not working for us sResult10 = (sAmt/1000)*sRate10<BR> Case 15<BR> sRate15 = rs("rate")<BR> Case 20<BR> sRate20 = rs("rate")<BR> Case 30<BR> sRate30 = rs("rate")<BR> End Select<BR> rs.MoveNext<BR> Loop<BR> End If <BR> rs.close<BR> con.close<BR> %&#062;

  2. #2
    Join Date
    Dec 1969

    Default RE: Calculations and ASP

    yes ,you can do calculation in ASP Application or you can write procedure in backend and then call the procedure in front application than it will be very easy and fast.

  3. #3
    Join Date
    Dec 1969

    Default Type mismatch

    Convert sAmt to numeric sAmt = CDbl(sAmt)<BR>BTW you don&#039;t use the connection object, why create it?

Posting Permissions

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