Skip to content

Raw sql command - string equals string #383

@PisinO

Description

@PisinO

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions