This is the script of my table:
CREATE TABLE ClientTypes
(
type_id int PRIMARY KEY IDENTITY,
type_name varchar(250) not null,
type_applications_list text,
dtIntro datetime DEFAULT(getdate())
)
And in ASP.net i’m trying to do this:
protected void btnActualizar_Click(object sender, EventArgs e)
{
var aplicacao = (from apl in dc.ClientTypes
where apl.type_id == tipoCliente
select apl).Single();
aplicacao.type_name = txtAplicações.Text.ToString();
dc.SubmitChanges();
}
However, when it runs, it crashes and says:
“The data types text and varchar are incompatible in the equal to operator.”
I really don’t want to change the SQL Datatype to varchar, i would like it to stay in text.
I have made some tests, with other datatype values, like int… and everything went well.
I really don’t understand this, has im using a control which returns a String.
Thx in advance
Can anyone help me?
Thx in advance.
MSDN states that you should not use the text data type as it will be removed in future versions of SQL Server. The text data type cannot be compared or sorted so if you want to compare in your LINQ query, you’ll have to change the type.