Tuesday, August 18, 2009

Need URGENT help with Gridview not displaying records that have NULL values in db

Need URGENT help with Gridview not displaying records that have NULL values in db

Hi...

I have a dropdown and 3 textboxes at the top of the page. Dropdown is for school, then textboxes for FirstName, LastName, and Address... I have one button that when clicked uses those criteria to pull data back from one Students table in the database.

The parameters are School = @School, FirstName LIKE @FirstName + '%', LastName LIKE @LastName + '%', Address LIKE '%' + @Address + '%'.

In the database, there are records where the Address field has NULL values.

The gridview will NOT pull those records into the gridview display. If I put a value in for the Address field in that record, it shows up fine.

NULL is only placed in the Address field after an update has occurred on that record. The database in its initial state had all Empty Address fields for all records, so it pulls up most records, just NOT those that have been Updated and a NULL value was pushed into that field.

I have tried putting a Default Value in the Address parameter, but that will not work...

I have also tried putting WHERE ((Address LIKE '%' + @Address + '%') OR (Address IS NULL)), but that is not a real solution b/c if I actually have an address im wanting to use for search criteria it will pull up all those records that have an Address field that IS NULL along with records that have address criteria that matches what I typed in the textbox.

How do I resolve this, please?


View Full Details...............................

No comments:

Post a Comment