473,405 Members | 2,154 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

FOR EACH - NEXT SubTotal Calculation

Hello All! My problem is trying to calculate SubTotal in my FOR EACH
NEXT Loop. I am looping through depending on how many of each different
item is in the user's shopping cart. I am using each Item ID in the
cart to display the appropriate image, artist name, and price
information for each item in the cart. I am running into problems when
I try and display the subtotal and add a count of each item in the
shopping cart. More importantly I am trying to come up with the
SubTotal. Here is the snippet of code for my loop:

<----------------------------------------------------->

Dim MyCookie as new httpCookie(MyCookieName)
Dim intCount as integer = 0
Dim intSubTotal as integer = 0
Dim objConn as new
OLEDBConnection(ConfigurationSettings.AppSettings( "StrConnection"))
Dim strSQL as string = "SELECT ITEM ID, imageDIR, Price, ReleaseDate
FROM tblDescription WHERE "

FOR EACH myItem as DictionaryEntry in gtCart
intCount = intCount + 1
intSubTotal = intSubtotal * .8
MyCookie.Values(myItem.Key) = myItem.Value

strSQL += "ITEMID= '" & myItem.Key & "'"

IF intCount < gtCart.Count
strSQL += " OR "

ELSE

strSQL += ";"
END IF

NEXT

<----------------------------------------------------->

The FOR EACH NEXT Loop that I have listed works magnificently for
figuring out if I have multiple items in my shopping cart and displays
everything perfectly. I try to reference intSubTotal (20% off each) in
the body of my page (nested inside of my FORM runat="Server") and it
does not work. Can anyone shed some light on how to go about creating a
variable for SubTotal and displaying it on my page?

SideNote: myItem.Value is how many of each ITEMID is in the shopping
cart. How can I reference this in my DataGrid?

Nov 19 '05 #1
2 1710
Nobody huh?

Nov 19 '05 #2
Thanks!

Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: J. T. | last post by:
I'm fairly new to XSL, but have made some good progress in picking it up for the project I'm currently working on. I've been trying to figure out how to design a stylesheet that would transform...
3
by: xian2 | last post by:
Hi All, I am trying to create a subtotal text box much like the one in the orders form of the northwind database where you have a subtotal text box in the footer of the subform and then have that...
5
by: mebrabham | last post by:
Hello, I am trying to create a running subtotal in a query and then graph the running subtotal for each city group. The data looks like this in the table (for illustration): My City My...
2
by: mouac01 | last post by:
I have this array: How would I get the subtotal of each acct so that total for A1 dr/cr is 400 and total for A2 dr/cr is 600. TIA...
8
by: dilipkvarma | last post by:
Hi All, I am trying to create a subtotal in an Excel sheet through Perl script. Some how I am not able to make it work. Here is what I wrote $Sheet->Activate; $Range =...
1
by: tam76131 | last post by:
Hello, I'm very new to access and have been struggling with the subtotal function in access. I have a very large table with the following info State City ID Month ...
1
by: eskelies | last post by:
Hello all, Does anyone have any code that will subtotal a query in Access? Thank you. BEFORE: Account Code Principal Income 4 BUY $10.00 $0.00 4 BUY $10.00 $0.00
2
by: murch.alexander | last post by:
Hi all, I have a query that uses a subquery to subtotal one of its fields. This part is working fine. The twist is that when I encounter certain values, I want to reset the subtotal to zero and...
12
by: etmanage | last post by:
I have a subform that totals a subtotal in the form footer. It works fine. I then pull that value onto the main form into a textbox called Subtotal2 by setting the control source...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.