Sjoelbakje
Sjoelbakje

Reputation: 33

SQL runs in Access but not in ASP.NET webform

I'm running the following statement:

SELECT product_naam, omschrijving 
FROM product 
WHERE (product_naam LIKE '*' + ? + '*') OR (omschrijving LIKE '*' + ? + '*')

It runs fine in Microsoft Access, but when I run it in ASP.NET with a grid view output, it does not give me any output.

Upvotes: 1

Views: 73

Answers (2)

st4hoo
st4hoo

Reputation: 2204

In ADO.NET % is a wildcard corresponding to * in MSAccess. Change your query like below and it should work:

SELECT product_naam, omschrijving 
FROM product 
WHERE (product_naam LIKE '%' + ? + '%') OR (omschrijving LIKE '%' + ? + '%')

More details here

Upvotes: 1

user3703582
user3703582

Reputation:

try changing the wild cards from * to %

SELECT product_naam, omschrijving 
FROM product 
WHERE (product_naam LIKE '%' + ? + '%') OR (omschrijving LIKE '%' + ? + '%')

Upvotes: 0

Related Questions