By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,868 Members | 1,974 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,868 IT Pros & Developers. It's quick & easy.

Remove Duplicate in drop down list ASP CLASSIC

P: 1
I retrieved all the records from database, and there are lots of duplicates due to pushing all the records into drop down list.

Code:

Expand|Select|Wrap|Line Numbers
  1.     SQL = "SELECT * FROM insite.holiday where calendar_Type= '" &sCalendarType& "' order by date_holiday"
Reason for not using distinct is due to other fields are required from this query.

Before:

>2013,2013,2013,2013,..... 2014,2014... 2015,2015,2015...

I want to filter up the record in drop down list to become:

>2013,2014,2015

I know it need a condition in between the loop but I can't figure it out.

Please Help. thanks

Below is my code :

Expand|Select|Wrap|Line Numbers
  1.     response.write(" <select name=""year1"">")
  2.     Do While not rs.eof
  3.         nDateHoliday = rs("date_holiday")
  4.         Ndate= year(nDateHoliday)
  5.         response.write("<option value=" & Ndate & ">" & Ndate & "</option>" & vbCrLf)
  6.         rs.MoveNext()
  7.     Loop
  8.     response.write("</select>")
Jun 18 '13 #1
Share this Question
Share on Google+
1 Reply


Rabbit
Expert Mod 10K+
P: 12,370
Please use code tags when posting code.

You said you can't use distinct but I don't see why not. I don't see where you use any of those other fields in your code.
Jun 18 '13 #2

Post your reply

Sign in to post your reply or Sign up for a free account.