Author: Jackxxx | Posted on: 8/17/2008 9:16:09 AM | Views : 626

Can someone look at this where clause and tell me why it does not work the way I wnat it to?

I have a page with first and last name search text boxes. I want the user to be able to enter either or both a first and last name to perform a search. The way I have it now requires that a first and last be entered.
The MailTo is not passed in and just returns the address marked as true in the database.WHERE ((G.LastName Like @LastName) AND (A.MailTo=1) or (@LastName IS Null)) and ((G.FirstName Like @FirstName) AND (A.MailTo=1) or (@FirstName IS Null))   ...

Go to the complete details ...