I am developing a web page for search. I have two options to build this page

1. To build the query on page according to parameter enter by the user and send it to server.
2. To send parameters to stored procedure and build query there and get it executed.

I want to know that which approach I should adopt and why. 

I want to know the advantages or disadvantages of both approaches.