Developing the Product Search Functionality

The product search functionality is made up of four main parts: a stored procedure, an additional method in the MyGolfGearDP class, the SearchResult code behind class, and the SearchResult.aspx file.

spFindProducts

The easiest way to search for a product is to search by name and/or description. The MyGolfGear.NET database has a single stored procedure called spFindProduct that serves this purpose. Listing 6.10 shows the code for this stored procedure.

Listing 6.10. The spFindProduct Stored Procedure
 CREATE PROCEDURE spFindProducts ( @SearchText varchar(50) ) AS SELECT ProductID, [Name], ShortDescription, LongDescription FROM Product WHERE Name LIKE '%' + @SearchText + '%' OR ShortDescription LIKE '%' ...

Get Building e-Commerce Sites with the .NET Framework now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.