Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > Adobe Web Programming > Dreamweaver (all versions)
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Dreamweaver (all versions) section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 20th, 2003, 06:22 AM
Authorized User
Join Date: Jun 2003
Location: Dublin, , Ireland.
Posts: 65
Thanks: 0
Thanked 0 Times in 0 Posts
Default Prevent Product Duplicates

How can I prevent a product duplicatting.

I have a page CatType.asp that submit to itself and shows at the bottom a list of products based on the CatID.
Is kind of tree view but it shows at the bottom instead under that category.

The thing is, some products are repeating because they are in the database under different cat types.

Is there any way of filtering the product <%if found do not duplicate%>?

Do you also know anywhere an function example to actually display the product under the category that belongs to - expand collapse type- as in this forum.
Reply With Quote
  #2 (permalink)  
Old September 20th, 2003, 02:08 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts

Hi there,

It depends a little on why you have the duplicates, and where you want to hide / filter them.

For example, you can use the keyword DISTINCT in an SQL query so it just returns unique records. This is a clean and quick way as it will just return the relevant records from the database, instead of passing them all.

Alternatively, you can use some loop code in ASP to accomplish this. To make this work, you duplicate records should come after each other in the recordset, so make sure you use a good ORDER BY clause to sort them correctly.
  Dim OldValue
  Do While Not myRS.EOF
    If myRS("Column1") = OldValue Then
      ' Product has already been sent to the browser, so do nothing
      myRS("Column1") = OldValue
    End If
This code prints out the value for Column1. Before it does that, it checks whether it has already been written. If not, it's value is added to the page Response, and the variable OldValue is filled with the current value from the Recordset.

You should consider the cause of the problem as well/ Should you duplicate records have been in the database in the first place?

Does this help?



Imar Spaanjaars
Everyone is unique, except for me.
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
refresh - product listing/availability tapitapovs BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 January 30th, 2008 09:53 AM
Product code generator yogeshyl Excel VBA 1 October 3rd, 2007 10:50 AM
Change image to product name zulf BOOK: Professional SQL Server 2005 Reporting Services ISBN: 0-7645-8497-9 0 June 14th, 2007 12:55 AM
A product development problem. madhukp Pro VB 6 3 December 8th, 2005 01:44 PM
Validation to Prevent Duplicates Roly Reefer Access VBA 1 August 19th, 2005 08:21 AM

All times are GMT -4. The time now is 11:44 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.