how to add null values ​​from the database

advertisements

I am populating a comboBox from a database through the use of its propery - Use Data Bound Items
Instead of making another table, I just added another 2 Columns in MainTable.
they should be DVRID and DVRIP
then I populated my comboDVR from DVRID and I get DVR16F & DVR14F on my dropdown and their selectedValues are from DVRIP which is their own ip addresses.
I typically get what I want, only problem is, since I populated my comboDVR from a column, it gets all items in that column even the null ones..

so when I dropdown, its too long.. and if a user click on a blank item, throws and exception.
is there a way that I can remove or not get null values from DRVID column? or do I need to create a separate table for that?

btw I do this because my boss said he does not want the client to manually input the dvr's ip address so he wants a dropdown menu of the dvrs' names instead.


Change your SELECT query to filter out the rows where DVRID is NULL, like this:

SELECT ID, MarkerName, Latitude, Longitude, CameraID, DVR, HostAddress, DVRID, DVRIP
FROM YOUR_TABLE_NAME
WHERE DVRID IS NOT NULL