dcsimg
www.webdeveloper.com
Results 1 to 3 of 3

Thread: SQL/ASP Calculated query question

  1. #1
    Join Date
    Nov 2004
    Posts
    21

    SQL/ASP Calculated query question

    Hi,
    I am working on an ordering system with no transaction. I have been able to develop the database and the ordering form and works fairly well. What the system does is:
    A user logs into the site, places and order from our catalogue into an insert form with the option for inputing product code and quantity. I keep track of the order by Session information. Everytime a record is inserted a query multiplies unit price by quantity ordered and gives a line result or individual result. Another query adds all the line results into a subtotal, and I am trying to come up with a query that would calculate the taxes for the order.

    There are 3 types of taxes depending on the province the user is from.

    The query below works half way because it only calculates one time. What I want is to calculate for every order. I'm using Access/ASP and Ddreamweaver MX 2004. Please if anyone can help me would be great. I've been working on this for a week now and I don't seem to get anywhere.

    <%
    Dim rsSubGST__MMColParam
    rsSubGST__MMColParam = "0"
    If (Session("MM_intUserID") <> "") Then
    rsSubGST__MMColParam = Session("MM_intUserID")
    End If
    %>
    <%
    Dim rsSubGST
    Dim rsSubGST_numRows

    Set rsSubGST = Server.CreateObject("ADODB.Recordset")
    rsSubGST.ActiveConnection = MM_connStuff_STRING
    rsSubGST.Source = "SELECT (intQuantity * catalogue_price * GST/100) AS GSTsub FROM tblOrders, Products, tblProvince WHERE prodID = product_code AND userID = " + Replace(rsSubGST__MMColParam, "'", "''") + ""
    rsSubGST.CursorType = 0
    rsSubGST.CursorLocation = 2
    rsSubGST.LockType = 1
    rsSubGST.Open()

    rsSubGST_numRows = 0
    %>

  2. #2
    Join Date
    Jun 2003
    Location
    Indiana, USA
    Posts
    1,138
    I think when you change the amount of items that you have, you will need to refresh the page so it can go back through your sql query.

  3. #3
    Join Date
    Nov 2004
    Posts
    21
    Thanks for the reply. That's what I though but it doesn't work. I have come to believe that I need to create some kind of function that instead of calculating the taxes for each entry, it will calculate the taxes for the subtotal. The problems is , I don't know how to create function using ASP. If anyone has a sample oe lead as to where to find one, it will be very much appreciated.


    Javier

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles