Thunderstruck icon indicating copy to clipboard operation
Thunderstruck copied to clipboard

SQL like does not work with parameters

Open GusBeare opened this issue 9 years ago • 2 comments

I believe I have noticed a bug and it's a significant one.

In your readme you have this:

context.All<Car>("SELECT * FROM Cars WHERE Name LIKE %@0%", "Lotus");

But this causes an object ref error because there are no single quotes around the expression. But, when I try this:

var ads = context.All<myTable >("select * from myTable where Title like '%@0%'","Vis");

The parameter is ignored.

Don't supposed you can fix this?

GusBeare avatar Sep 29 '15 15:09 GusBeare

I found a workaround so this might be by design and not a bug:

var ads = context.All<MyTable>("select * from Mytable where Title like @0","%Vis%");

Perhaps you could update the readme?

GusBeare avatar Sep 29 '15 15:09 GusBeare

Hi @GusBeare, thanks for share this issue. I will fix the README.

19WAS85 avatar Oct 01 '15 16:10 19WAS85