SELECT ProductID, Description, CatalogId, CategoryId, BrandID, SupplierID, buffer, reorder, balance, type,
SELECT CategoryName FROM Category
WHERE (CategoryID = Products.CategoryId)) AS categoryname,
(SELECT CompanyName FROM Suppliers
WHERE (SupplierID = Products.SupplierID)) AS companyname,
(SELECT BrandName FROM Brand
WHERE (BrandID = Products.BrandID))
AS brandname
FROM Products
WHERE (Description LIKE @description + '%') AND (CategoryId = @categoryid)
AND (BrandID = @brandid)
Currently i am using this query to return me product details by passing three parameters CategoryID comes from combo box and BrandId comes from listbox, but here Description is textbox so when ever user enters few characters in description textbox it should list me the products which matches the first few characters entered in textbox.
I am using Microsoft sql server express edition and web developer express edition, so want to write query in sql server express, the abobe query is ok but the problem which i encounter is that as soon as i run the program it says "Value cannot be null value in description". I dont want to predefine the value in description parameter in query want to get that parameter from textbox.
And i dont want user to enter the wildcard characters also, it should just take first few characters and list me all products which starts from those characters.