Last post Jun 29, 2015 10:45 AM by starbearer
Jun 24, 2015 11:45 AM|starbearer|LINK
I currently need a page in my application that will generate the count (null) values of corresponding columns for a record in a textbox below the actual search bar. The search bar will essentially be a dropdown menu containing district ID numbers and every
time I select a district ID number and hit search the box below should display the various counts of null values in different columns.
I am trying to figure out how to do this. On a page I will enter something to the effect of "NUMBER OF NULL First Names =" and it is after this equal to that the null count should be displayed of that column. My table currently has:
District ID | First Name | Last Name | ID 1 | ID 2 | ID 3
When I select the District ID from my list, I should view the null counts in the rest of the columns with that attached District ID. This table is in my SQL database. How do I do this? HELP!
Jun 24, 2015 11:54 AM|PatriceSc|LINK
If SQL Server, you could use :
SELECT SUM(CASE WHEN FirstName IS NULL THEN 1 ELSE 0 END) AS FirstNameNullCount,
SUM(CASE WHEN LastName IS NULL THEN 1 ELSE 0 END) AS LastNameNullCount,
Basically it just does a sum for each column, counting 1 for null values and 0 otherwise.
Jun 25, 2015 02:33 PM|starbearer|LINK
Hello. Thank you for your response.
I am not looking for the SQL query as much as I am looking for a way to get the value selected in my dropdownbox to be used in the query. Thank you.
Jun 25, 2015 05:39 PM|Dan Palacios|LINK
Maybe you can use the query given by PatriceSc to fill your dropdown and then after select the value from dropdown use it in the search query.
Jun 26, 2015 09:20 AM|PatriceSc|LINK
So you are looking just for the SelectedValue property of your dropdown control? See also http://www.csharp-station.com/Tutorial/AdoDotNet/Lesson06 for how to feed a SQL query with a
If it doesn't help try to give all useful relevant details about your exact issue (but not more than needed) and please rephrase the question (even the title about a textbox and using like doesn't match the content where it seems you are using a dropdowbox
Jun 29, 2015 10:45 AM|starbearer|LINK
Hello Patrice. Thank you for your patience. I posted my new query after your suggestion here but I cannot seem to open it.