473,386 Members | 1,799 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.

Search database with dropdownlist

OuTCasT
374 256MB
i have 4 dropdownlist boxes on my form.
it controls a datagridview on the page.
The datagridview is populated with certain values from the selections of the dropdownlist boxes.
i got the select statement to retrieve the information that i require from the different selections.
Problem is that if i leave 1 dropdownlist box with no selection no information is returned into the datagridview..

here is the select statement that ive used it works in query analyser so i figured that there might be something that has to be done on the page itself or dropdownlist boxes.

Expand|Select|Wrap|Line Numbers
  1. SELECT  *  FROM [cvinformation] WHERE (([race] = CASE WHEN @race IS NOT NULL THEN @race ELSE [race] END) AND ([province] = CASE WHEN @province IS NOT NULL THEN @province ELSE [province] END) AND ([field] = CASE WHEN @field IS NOT NULL THEN @field ELSE [field] END) AND ([gender] = CASE WHEN @gender IS NOT NULL THEN @gender ELSE [gender] END))
is there something that im doing wrong
Mar 17 '08 #1
1 1476
debasisdas
8,127 Expert 4TB
You need to frame the SQL statement dynamically. If one drop down is not selected then that that column should not the included in the SQL statement to query the database table.
Mar 18 '08 #2

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

Similar topics

2
by: SirPoonga | last post by:
Lets say I have a couple of tables in a database containg car make, type, and model. I want to create a drop down box that is populated by the makes. Based on that selection run a query to get...
2
by: Andre | last post by:
Hi, I retrieve data from a SQL Server and put the data on a DropDownList, but my problem is that sometime i have the same value more than one time, so i want to search the DDL to see if there's...
0
by: Seok Bee | last post by:
Dear Experts, I would like to have a listing of my current table records based on certain search criterias to list out in the gridview control. However, I have tried to use the built-in...
2
by: John Haycock | last post by:
Can anyone recommend a good component For adding a search feature to a website that will search the text in a database Thanks in advance John
1
by: gomathinayagam | last post by:
hai, am only beginer in c#... i am trying to connect database with webform. using a technique that the fields of the table and the controls in a form are named same...then i try get the controls...
1
by: scottichrosaviakosmos | last post by:
Please solve my issue . i want to develope a search form for which will search the values from a table and fetch the values from the table and show that value in the a gridview. now i am going...
1
by: asp beginner | last post by:
I am building an Eccomerce site and I am trying to make my shopping cart work. I am having a problem with when I have entered data into my form it is not submitting into my access database. This my...
22
by: asmx126453 | last post by:
hey guys can somonehelp i got an error on rule 3 and it says error: txtbox is empty or not an object this is the code out my aspx page <script language="javascript"...
2
by: rajendrsedhain | last post by:
Hi, I have 1 checkboxlist, 5 dropdownlits and three textboxes.I have to write the SQL query and c# code for that advanced search. <asp:CheckBoxList ID="reposotoryCheckBoxList" runat="server"...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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.