473,386 Members | 1,721 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,386 software developers and data experts.

Problem in Searching Multiple selects from a DropDown in Classic ASP

4
Hello Thr. I know I am doing it correctly but, missing some very minor thing. I have a form whr I have 5 drop down lists and searching th ose values from a database. I already have entered some values in my database. When I try to run this below mentioned sql query with just one subskill, it runs fine. But when I run it with multiple subskills, it doesnt come up with any result. It says no record found. Please help me.

Below mentioned is my sql query.
Expand|Select|Wrap|Line Numbers
  1. t1=request("skill")
  2. t2=request("subskill")
  3.  
  4. t4=request("simple")
  5. t5=request("medium")
  6. t6=request("complex")
  7.  
  8.  
  9.  
  10.  
  11. if t1 <> "" and t2 <> "" and t4 <> "" and t5 <> "" and t6 <> "" then
  12.  
  13. If InStr(t2,",") > 0 Then
  14. arrTerms = Split(t2,",")
  15.  
  16. For x = 0 to UBound(arrTerms)
  17.  
  18. login = "(select TOP "&t4&" * from skills where dept Like '%"&t1&"%' and desg Like '%"&arrTerms(x)&"%' and rating='simple')"
  19. 'login = login & "UNION (select TOP "&t5&" * from skills where dept Like '%"&t1&"%' and desg Like '%"&arrTerms(x)&"%' and rating='medium')"
  20. 'login = login & "UNION (select TOP "&t6&" * from skills where dept Like '%"&t1&"%' and desg Like '%"&arrTerms(x)&"%' and rating='complex')"
  21.  
  22. If x < UBound(arrTerms) Then 
  23. login = login & " AND "
  24. End If
  25.  
  26. Next 'x
  27. 'login = login & " ORDER BY rating ASC;"
  28.  
  29. else 
  30. login="(select TOP "&t4&" * from skills where dept Like '%"&t1&"%' and desg Like '%"&t2&"%' and rating='simple' ORDER BY Rnd(Len([question]))) UNION (select 
  31.  
  32. TOP "&t5&" * from skills where dept Like '%"&t1&"%' and desg Like '%"&t2&"%' and rating='medium' ORDER BY Rnd(Len([question]))) UNION (select TOP "&t6&" * 
  33.  
  34. from skills where dept Like '%"&t1&"%' and desg Like '%"&t2&"%' and rating='complex' ORDER BY Rnd(Len([question])))"
  35.  
  36. End If
  37. End If
Aug 1 '10 #1
1 2093
jhardman
3,406 Expert 2GB
print out your final query (response.write login) with one skill and with multiple skills and compare them. 95% of the time you will see a mistake at this point.

Second, run both of these queries through a query analyzer and see if they return the expected results. If it doesn't, then this is an issue with your SQL.

Jared
Aug 6 '10 #2

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

Similar topics

1
by: Marc | last post by:
Hello, I have a form with multiple selects (pullDown). All selects have the same name but each select has a different value. The user selects a value in each select. When he submits the form I...
6
by: JackT | last post by:
I want to get a column count several times in one query using different filters but can't work out how to do it - can anyone point me in the right direction? For example, how would combine these...
1
by: d.schulz81 | last post by:
Holas, I want to do the following: If one entry in multiple select "domain" is selected, i want to change the content in dropdown "typ" dynamically according to the selected domain. If more...
12
by: Peter Proost | last post by:
Hi group, has anyone got any suggestions fot the best way to handle this problem, I've got 3 tables for example table A, B, and C table A looks like name, value table B looks like name, value...
2
by: Bruno Alexandre | last post by:
Hi guys, I hope you can pointing me some tutorials or examples to: in a Gid View I want to have: first Row: next rows |---> 4 columns that I get from a select with the serial...
2
by: Lair | last post by:
I am creating a page that has three to four databound dropdown lists. Each one is has different data sometimes from the same table but with a different where clause. What is the best way to...
0
by: qudra | last post by:
Searching multiple records -------------------------------------------------------------------------------- Hi guys. I need ur help. In VB.NET we usually use this code to search the database...
2
by: Mad Joe | last post by:
Hello, is there any free script that could help me to create a dropdown menu (with multiple columns) like the one at washingtonpost.com?
1
by: psybert | last post by:
(cross posted from JavaScript forum) Hello everyone, Long time lurker, first time poster. I'm a beginner coder, and I've taught myself everything with the help and expertise of users and websites...
3
by: Antonio Rivas | last post by:
Hello all. I've got a problem of multiple definition in a program that at first glance looks correct (I won't type the whole code, just the relevant one and as examples since seems is a linkage...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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...

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.