Hi,

Does anyone know how too solve this:

I want to delete a row from database and I keep getting this error:
The ntext and image data types cannot be used in WHERE, HAVING, GROUP BY, ON, or IN clauses, except when these data types are used with the LIKE or IS NULL predicates. delete from database

string test = "test";
Message m = db.Messages.Single(p => p.Name.StartsWith(test))
db.Messages.DeleteOnSubmit(m);
db.SubmitChanges();

Table name is Messages
Name is type ntext

Member Avatar for stbuchok

Delete based on an Id column. You've really already answered your own problem. Name is type nText and you are using it in a where clause (look at your lambda expression). So basically don't use Name in your lambda.

Can I delete it without using the lambda expression? I mean the row where Name == text ?

I got the same error for this query :

Aktive a = da.Aktive.First(p => p.Average.Equals(22.4));

da.Aktive.DeleteOnSubmit(a);
da.SubmitChanges();

In this example Average is type float

which is the error in sql

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.