In my query is this line
//query...
"AND (@4 = '' OR (p.FirstName + p.LastName LIKE '%' + @4 + '%') OR (eup.FirstName + eup.LastName LIKE '%' + @4 + '%')) " +
//more query...
This is giving me a Data is null exception.  Param @4 is coming in as "".  When I changed this to 
"AND (@4 IS NULL OR (p.FirstName + p.LastName LIKE '%' + @4 + '%') OR (eup.FirstName + eup.LastName LIKE '%' + @4 + '%')) " +
It is not returning records that don't have a firstname or lastname in either table.
How can I address this? If param 4 is empty I want to return all records regardless of the name existing or not.
 
Aucun commentaire:
Enregistrer un commentaire