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

Select

OuTCasT
100+
P: 374
Hi everyone.
I have a little search thing going on on one page.
web based application.
now its searching for students from different place and according to race and age etc.

i have 5 dropdown list boxes, that all have been bound to the database
like Province, education, race etc

now i used a SELECT statement to search those specific field and show results in a gridview.
and once they click select on the gridview a forms view opens with the students details.

The problem is that the select statement always only take the first dropdownlist's text and searches, and say i didnt take the first dropdownlist which is PROVINCE and take the second one which is RACE, then no data is returned.

here is the query


Code: ( sql )
SELECT name,surname,FIELD, FROM cvInformation WHERE (FIELD=@FIELD) OR ([province]=@province) OR (education=@education)
Feb 6 '08 #1
Share this Question
Share on Google+
3 Replies


debasisdas
Expert 5K+
P: 8,127
You need to frame the query dynamically at run time and include IS NULL to check for the values if uses skips selection of some items from combo box.
Feb 6 '08 #2

OuTCasT
100+
P: 374
You need to frame the query dynamically at run time and include IS NULL to check for the values if uses skips selection of some items from combo box.

but say i have 3 cmbox's
Province
Age
Race

and he chooses
Province = "AU"
Age = "20"
Race= " NOTHING SELECTED"

then its going to still check for the age and province.??? correct
Feb 6 '08 #3

debasisdas
Expert 5K+
P: 8,127
You need to frame the query dynamically at run time and include IS NULL to check for the values if users skips selection of some items from combo box.
Feb 6 '08 #4

Post your reply

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