Looping through records
Looping through records
Looping through records
Looping through records
Looping through records
Looping through records Looping through records Looping through records Looping through records Looping through records Looping through records Looping through records Looping through records
Looping through records Looping through records
Looping through records
Go Back  Xtreme Visual Basic Talk > > > Looping through records


Reply
 
Thread Tools Display Modes
  #1  
Old 05-09-2011, 11:19 AM
calder calder is offline
Contributor
 
Join Date: Nov 2005
Posts: 483
Default Looping through records


Okay I'm getting a headache lol.

Let me give you a bit of background first. I have taken over development of an online application built in ASP with VB as the code behind. The application has a few aspects to it but it's basically a customized store front.

Now let me explain I am pretty much brand new to ASP and learning as I go so if you can help please be as descriptive as possible.

What I'm trying to do should be (I think) relatively simple. As I said it's a store front, so it has a shopping cart. The previous developer was resetting the shopping cart count to 0 every time you loaded the page (don't ask... pricing was using integer data types too >.>) All I want to do is when a customer logs in have it loop through one table and sum up the quantities in that table. The display stuff I can do no problem, most of the queries too but this one has me baffled.

Oh and it's an Access backend (did I mention don't ask? lol) if that matters, which I am guessing it does.

So simply put.
I have an asp application running on an Access backend. It uses master pages and has different ones for what type of user you're logged in as. What I would like to do is check if the user has any items in their shopping cart and total those items as soon as they log in. It can't be a row count since a row may contain more than one of an item on order.

Any help is greatly appreciated. As for the obligatory "dump Access" comments that I deserve, trust me I will eventually, but right now the goal is to get the current application working and rewrite it when I have the time to devote.

You can view the application at http://www.refficient.com

Thanks in advance!
__________________
I have learned more about VB from this forum in 3 months than I learned alone in 1 year. Share your knowledge and learn from others ;)
Reply With Quote
  #2  
Old 06-01-2011, 09:01 AM
alexsts alexsts is offline
Freshman
 
Join Date: Apr 2010
Posts: 32
Default

Are you talking about ASP.NET or classic ASP with VBScript?
Reply With Quote
  #3  
Old 06-01-2011, 09:08 AM
alexsts alexsts is offline
Freshman
 
Join Date: Apr 2010
Posts: 32
Default

Principle in classic ASP would be :
1. Assign to user unique id for this session only at the time when you verified his credentials. As you noticed same client could potentially get to your site more then once :-)). And you do not want to count what he pick yesterday or week ago.
2. Make sure that all items user/client choose to place in cart have FK(foreign key) associated with this user-session
3. Do sql=select distinct Item from Table where user-session=YourUserID
set Rs=Connection.Execute(sql)
counter=0
if not Rs.EOF
Rs.MoveFirst
do until RS.EOF
counter=counter+1
RS.MoveNext
loop
end if
counter will show you how many items in your cart for this user.

This is Classic ASP approach!!!
Basically ASP.NET idea would be similar. Just workout code.

notation: Distinct in SQL only to make sure that same item name not counted more than once.
If your code does not do proper verification what client picking up to the cart. :-))
Normally in my sites I do and client getting message: Item already in your cart if he/she try to pick same items.

Last edited by alexsts; 06-01-2011 at 09:17 AM. Reason: added notation
Reply With Quote
  #4  
Old 06-03-2011, 08:57 AM
calder calder is offline
Contributor
 
Join Date: Nov 2005
Posts: 483
Default

Sorry it's ASP.NET (3.5) Thanks, I'll take a closer look later, this is actually dropped way down on the priority list of things to do for the site lol. I do appreciate the time you took though and I will fix it =)
__________________
I have learned more about VB from this forum in 3 months than I learned alone in 1 year. Share your knowledge and learn from others ;)
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Looping through records
Looping through records
Looping through records Looping through records
Looping through records
Looping through records
Looping through records Looping through records Looping through records Looping through records Looping through records Looping through records Looping through records
Looping through records
Looping through records
 
Looping through records
Looping through records
 
-->