SQLite.Net-PCL icon indicating copy to clipboard operation
SQLite.Net-PCL copied to clipboard

Raw sql command - string equals string

Open PisinO opened this issue 6 years ago • 0 comments

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?

PisinO avatar Sep 05 '19 14:09 PisinO