Help Grid View Drop Down List, view all
Hello everyone. Just started learning ASP.NET 2.0 and I am loving it so far. Here is something I am trying to accomplish but can't seem to figure it out, maybe one of you will have an idea of how I can do this.
I have three Drop Down Lists: Year, Month, Day. These drop downs, all have the auto postback feature enabled. I have a database with the columns Year Month Day, sample data from each filed would be 2007, 10, 25. My gridview currently takes the selection of all three boxes and displays all corresponding records that match the criteria.
What I want to be able to do though, is add a View All in the top of each of my drop down lists. This way I can select, Year: 2007, Month: 10, Day: View All and my gridview would return all records with the year 2007, the month 10, and any day value. It currently displays no records if any one of the three values I have specified are Null. Then if I wanted to I could change the day value to a number and it would still function the same. Here is the SQL statement I am using right now. Is there a value I can put in there that selects everything?
SELECT [UserName], [Year], [Month], [Day], [Time], [ComputerName] FROM [UserLogon] WHERE (([Year] = ?) AND ([Month] = ?) AND ([Day] = ?))
Maybe I am going about this wrong, if someone could point me in the right direction that would be great.
|