LINQ compare string and DB column type 'text'

This is my error message The data types text and varchar are incompatible in the equal to operator. My code is something like

var result = db.Table.Where(x => x.columnA == "A").ToList();

I know the reason is the columnA's type in DB is text so they can't match and I can't update the DB scheme.

Could I do this by using LINQ to SQL?

Update

This is my DAO

[Required]
[StringLength(10)]
public string MessageName { get; set; }

Solution 1:

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();

Solution 2:

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

var result = db.Table.Where(x => x.columnA.Contains("A")).ToList();

Solution 3:

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();

Solution 4:

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();