score:7

Accepted answer

text columns do not support the equal to operator, even in sql.

you must make it so your query translates into a like operator, which can be achieved with either contains (like '%str%'), startswith (like '%str') or endswith (like '%str').

if you need strict equality, something like this should work:

var result = db.table.where(x => x.columna.startswith("a") &&
                                 x.columna.endswith("a")).tolist();

score:0

i had the same issue and none of the string conversion solutions worked for me. the problem was that i had a 'text' data type for this column (because i migrated it from sqlite). solution: just change the data type to `'nvarchar()' and regenerate the table.

score:1

i tried all the above-mentioned solution and none of the fixes works for me, so here i am posting the fix which works for me

 var result = db.table.where(x => convert.tostring(x.columna) == "a").tolist();

score:2

can you cast the column in question to a string? i haven't got any way to test this as i don't have a db with a text type.

var result = db.table.where(x => x.columna.tostring() == "a").tolist();

score:3

you can use this (i haven't tested the code)

var result = db.table.where(x => x.columna.contains("a")).tolist();

Related Query

More Query from same tag