简体   繁体   中英

Constructing a search box in ASP.NET using DataSet

I have a DataSet file in an ASP.NET project, and this query works, however I want it to be able to incorporate LIKE '%' element. How can I add it into the SQL statement below, while keeping the variable element?

SELECT brand, model, location, piclink, colour, price, yearreg, carID 
FROM cars
WHERE brand = ?

I tried this but it won't work. Visual Studio claims that its unable to parse query.

SELECT brand, model, location, piclink, colour, price, yearreg, carID 
FROM cars
WHERE brand = ? + brand LIKE '%'

I have set up a populated drop down box with brand names of cars from an Access database, and I want now to use this modified query to search for results. Can you point me in the right direction, as to where and how to do that, please?

SELECT brand, model, location, piclink, colour, price, yearreg, carID FROM cars WHERE brand = '?' AND brand LIKE '%'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM