Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raw sql command - string equals string #383

Open
PisinO opened this issue Sep 5, 2019 · 0 comments
Open

Raw sql command - string equals string #383

PisinO opened this issue Sep 5, 2019 · 0 comments

Comments

@PisinO
Copy link

PisinO commented Sep 5, 2019

Lets say I have a simple table

public class Product
{
public int Id { get; set;}
public string Name { get; set; }
}

and want to select products with property Name equals to some string condition, so

Connection.Query<Product>("SELECT * FROM Product WHERE Name = '?'", "ASDF1234")

empty query is returned, I have same problem with ... LIKE '%?%'.
When I go through LINQ, everything is fine

Connection.Table<Product>().Where(x => x.Name == "ASDF1234")

but I want to select specific columns (SELECT col1 ...) only so I have to write raw SQL.

It looks like there are some problems with strings in conditions, or am I doing something wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant