The data types ntext and nvarchar are incompatible in the equal to operator












5















I have a problem and i dont know how to fix it.



I have a simple table in database



CREATE TABLE [dbo].[home] (
[Id] INT NOT NULL,
[text] NTEXT NOT NULL,
PRIMARY KEY CLUSTERED ([Id] ASC)
);


I`m using FormView in visual studio 2012, The FormView is connected with the Home table of the database and there is edit/update/delete options on.



The problem is that when I`m trying to Update the text in te database there is an error



The data types ntext and nvarchar are incompatible in the equal to operator.


A little help please..



This is the code I use to write in the DB :



    <%@ Page Title="" Language="C#" MasterPageFile="~/admin/adminmaster.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="admin_Default" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:FormView ID="FormView1" runat="server" DataKeyNames="Id" DataSourceID="SqlDataSource1">
<EditItemTemplate>
text:
<asp:TextBox Text='<%# Bind("text") %>' runat="server" ID="textTextBox" /><br />
Id:
<asp:Label Text='<%# Eval("Id") %>' runat="server" ID="IdLabel1" /><br />
<asp:LinkButton runat="server" Text="Update" CommandName="Update" ID="UpdateButton" CausesValidation="True" />&nbsp;<asp:LinkButton runat="server" Text="Cancel" CommandName="Cancel" ID="UpdateCancelButton" CausesValidation="False" />
</EditItemTemplate>
<InsertItemTemplate>
text:
<asp:TextBox Text='<%# Bind("text") %>' runat="server" ID="textTextBox" /><br />
Id:
<asp:TextBox Text='<%# Bind("Id") %>' runat="server" ID="IdTextBox" /><br />
<asp:LinkButton runat="server" Text="Insert" CommandName="Insert" ID="InsertButton" CausesValidation="True" />&nbsp;<asp:LinkButton runat="server" Text="Cancel" CommandName="Cancel" ID="InsertCancelButton" CausesValidation="False" />
</InsertItemTemplate>
<ItemTemplate>
text:
<asp:Label Text='<%# Bind("text") %>' runat="server" ID="textLabel" /><br />
Id:
<asp:Label Text='<%# Eval("Id") %>' runat="server" ID="IdLabel" /><br />
<asp:LinkButton runat="server" Text="Edit" CommandName="Edit" ID="EditButton" CausesValidation="False" />&nbsp;<asp:LinkButton runat="server" Text="Delete" CommandName="Delete" ID="DeleteButton" CausesValidation="False" />&nbsp;<asp:LinkButton runat="server" Text="New" CommandName="New" ID="NewButton" CausesValidation="False" />
</ItemTemplate>
</asp:FormView>
<asp:SqlDataSource runat="server" ID="SqlDataSource1" ConflictDetection="CompareAllValues" ConnectionString='<%$ ConnectionStrings:ConnectionString_SQLServer %>' DeleteCommand="DELETE FROM [home] WHERE [Id] = @original_Id AND [text] = @original_text" InsertCommand="INSERT INTO [home] ([Id], [text]) VALUES (@Id, @text)" OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT [Id], [text] FROM [home]" UpdateCommand="UPDATE [home] SET [text] = @text WHERE [Id] = @original_Id AND [text] = @original_text">
<DeleteParameters>
<asp:Parameter Name="original_Id" Type="Int32"></asp:Parameter>
<asp:Parameter Name="original_text" Type="String"></asp:Parameter>
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="Id" Type="Int32"></asp:Parameter>
<asp:Parameter Name="text" Type="String"></asp:Parameter>
</InsertParameters>
<UpdateParameters>
<asp:Parameter Name="text" Type="String"></asp:Parameter>
<asp:Parameter Name="original_Id" Type="Int32"></asp:Parameter>
<asp:Parameter Name="original_text" Type="String"></asp:Parameter>
</UpdateParameters>
</asp:SqlDataSource>
</asp:Content>


And this is where I want to get the text form DB and write it in to Label :



using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{


string DatabaseConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString_SQLServer"].ConnectionString;

string text = "SELECT text FROM home WHERE id=1";

using (SqlConnection conn = new SqlConnection(DatabaseConnectionString))
{
conn.Open();
SqlCommand cmd = new SqlCommand(text, conn);
box1_text.Text = (string)cmd.ExecuteScalar();

}
}


}









share|improve this question




















  • 1





    How are you updating the database info? Could you show that code too?

    – DutGRIFF
    Jan 22 '14 at 20:38











  • I added the code in the main question up there

    – user3224399
    Jan 22 '14 at 20:45











  • You can change the ntext type in database to nvarchar(max). That should resolve the error.

    – Ashish Charan
    Jan 22 '14 at 21:18











  • It Worked ! :) Tnx a lot

    – user3224399
    Jan 23 '14 at 7:53
















5















I have a problem and i dont know how to fix it.



I have a simple table in database



CREATE TABLE [dbo].[home] (
[Id] INT NOT NULL,
[text] NTEXT NOT NULL,
PRIMARY KEY CLUSTERED ([Id] ASC)
);


I`m using FormView in visual studio 2012, The FormView is connected with the Home table of the database and there is edit/update/delete options on.



The problem is that when I`m trying to Update the text in te database there is an error



The data types ntext and nvarchar are incompatible in the equal to operator.


A little help please..



This is the code I use to write in the DB :



    <%@ Page Title="" Language="C#" MasterPageFile="~/admin/adminmaster.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="admin_Default" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:FormView ID="FormView1" runat="server" DataKeyNames="Id" DataSourceID="SqlDataSource1">
<EditItemTemplate>
text:
<asp:TextBox Text='<%# Bind("text") %>' runat="server" ID="textTextBox" /><br />
Id:
<asp:Label Text='<%# Eval("Id") %>' runat="server" ID="IdLabel1" /><br />
<asp:LinkButton runat="server" Text="Update" CommandName="Update" ID="UpdateButton" CausesValidation="True" />&nbsp;<asp:LinkButton runat="server" Text="Cancel" CommandName="Cancel" ID="UpdateCancelButton" CausesValidation="False" />
</EditItemTemplate>
<InsertItemTemplate>
text:
<asp:TextBox Text='<%# Bind("text") %>' runat="server" ID="textTextBox" /><br />
Id:
<asp:TextBox Text='<%# Bind("Id") %>' runat="server" ID="IdTextBox" /><br />
<asp:LinkButton runat="server" Text="Insert" CommandName="Insert" ID="InsertButton" CausesValidation="True" />&nbsp;<asp:LinkButton runat="server" Text="Cancel" CommandName="Cancel" ID="InsertCancelButton" CausesValidation="False" />
</InsertItemTemplate>
<ItemTemplate>
text:
<asp:Label Text='<%# Bind("text") %>' runat="server" ID="textLabel" /><br />
Id:
<asp:Label Text='<%# Eval("Id") %>' runat="server" ID="IdLabel" /><br />
<asp:LinkButton runat="server" Text="Edit" CommandName="Edit" ID="EditButton" CausesValidation="False" />&nbsp;<asp:LinkButton runat="server" Text="Delete" CommandName="Delete" ID="DeleteButton" CausesValidation="False" />&nbsp;<asp:LinkButton runat="server" Text="New" CommandName="New" ID="NewButton" CausesValidation="False" />
</ItemTemplate>
</asp:FormView>
<asp:SqlDataSource runat="server" ID="SqlDataSource1" ConflictDetection="CompareAllValues" ConnectionString='<%$ ConnectionStrings:ConnectionString_SQLServer %>' DeleteCommand="DELETE FROM [home] WHERE [Id] = @original_Id AND [text] = @original_text" InsertCommand="INSERT INTO [home] ([Id], [text]) VALUES (@Id, @text)" OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT [Id], [text] FROM [home]" UpdateCommand="UPDATE [home] SET [text] = @text WHERE [Id] = @original_Id AND [text] = @original_text">
<DeleteParameters>
<asp:Parameter Name="original_Id" Type="Int32"></asp:Parameter>
<asp:Parameter Name="original_text" Type="String"></asp:Parameter>
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="Id" Type="Int32"></asp:Parameter>
<asp:Parameter Name="text" Type="String"></asp:Parameter>
</InsertParameters>
<UpdateParameters>
<asp:Parameter Name="text" Type="String"></asp:Parameter>
<asp:Parameter Name="original_Id" Type="Int32"></asp:Parameter>
<asp:Parameter Name="original_text" Type="String"></asp:Parameter>
</UpdateParameters>
</asp:SqlDataSource>
</asp:Content>


And this is where I want to get the text form DB and write it in to Label :



using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{


string DatabaseConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString_SQLServer"].ConnectionString;

string text = "SELECT text FROM home WHERE id=1";

using (SqlConnection conn = new SqlConnection(DatabaseConnectionString))
{
conn.Open();
SqlCommand cmd = new SqlCommand(text, conn);
box1_text.Text = (string)cmd.ExecuteScalar();

}
}


}









share|improve this question




















  • 1





    How are you updating the database info? Could you show that code too?

    – DutGRIFF
    Jan 22 '14 at 20:38











  • I added the code in the main question up there

    – user3224399
    Jan 22 '14 at 20:45











  • You can change the ntext type in database to nvarchar(max). That should resolve the error.

    – Ashish Charan
    Jan 22 '14 at 21:18











  • It Worked ! :) Tnx a lot

    – user3224399
    Jan 23 '14 at 7:53














5












5








5








I have a problem and i dont know how to fix it.



I have a simple table in database



CREATE TABLE [dbo].[home] (
[Id] INT NOT NULL,
[text] NTEXT NOT NULL,
PRIMARY KEY CLUSTERED ([Id] ASC)
);


I`m using FormView in visual studio 2012, The FormView is connected with the Home table of the database and there is edit/update/delete options on.



The problem is that when I`m trying to Update the text in te database there is an error



The data types ntext and nvarchar are incompatible in the equal to operator.


A little help please..



This is the code I use to write in the DB :



    <%@ Page Title="" Language="C#" MasterPageFile="~/admin/adminmaster.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="admin_Default" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:FormView ID="FormView1" runat="server" DataKeyNames="Id" DataSourceID="SqlDataSource1">
<EditItemTemplate>
text:
<asp:TextBox Text='<%# Bind("text") %>' runat="server" ID="textTextBox" /><br />
Id:
<asp:Label Text='<%# Eval("Id") %>' runat="server" ID="IdLabel1" /><br />
<asp:LinkButton runat="server" Text="Update" CommandName="Update" ID="UpdateButton" CausesValidation="True" />&nbsp;<asp:LinkButton runat="server" Text="Cancel" CommandName="Cancel" ID="UpdateCancelButton" CausesValidation="False" />
</EditItemTemplate>
<InsertItemTemplate>
text:
<asp:TextBox Text='<%# Bind("text") %>' runat="server" ID="textTextBox" /><br />
Id:
<asp:TextBox Text='<%# Bind("Id") %>' runat="server" ID="IdTextBox" /><br />
<asp:LinkButton runat="server" Text="Insert" CommandName="Insert" ID="InsertButton" CausesValidation="True" />&nbsp;<asp:LinkButton runat="server" Text="Cancel" CommandName="Cancel" ID="InsertCancelButton" CausesValidation="False" />
</InsertItemTemplate>
<ItemTemplate>
text:
<asp:Label Text='<%# Bind("text") %>' runat="server" ID="textLabel" /><br />
Id:
<asp:Label Text='<%# Eval("Id") %>' runat="server" ID="IdLabel" /><br />
<asp:LinkButton runat="server" Text="Edit" CommandName="Edit" ID="EditButton" CausesValidation="False" />&nbsp;<asp:LinkButton runat="server" Text="Delete" CommandName="Delete" ID="DeleteButton" CausesValidation="False" />&nbsp;<asp:LinkButton runat="server" Text="New" CommandName="New" ID="NewButton" CausesValidation="False" />
</ItemTemplate>
</asp:FormView>
<asp:SqlDataSource runat="server" ID="SqlDataSource1" ConflictDetection="CompareAllValues" ConnectionString='<%$ ConnectionStrings:ConnectionString_SQLServer %>' DeleteCommand="DELETE FROM [home] WHERE [Id] = @original_Id AND [text] = @original_text" InsertCommand="INSERT INTO [home] ([Id], [text]) VALUES (@Id, @text)" OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT [Id], [text] FROM [home]" UpdateCommand="UPDATE [home] SET [text] = @text WHERE [Id] = @original_Id AND [text] = @original_text">
<DeleteParameters>
<asp:Parameter Name="original_Id" Type="Int32"></asp:Parameter>
<asp:Parameter Name="original_text" Type="String"></asp:Parameter>
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="Id" Type="Int32"></asp:Parameter>
<asp:Parameter Name="text" Type="String"></asp:Parameter>
</InsertParameters>
<UpdateParameters>
<asp:Parameter Name="text" Type="String"></asp:Parameter>
<asp:Parameter Name="original_Id" Type="Int32"></asp:Parameter>
<asp:Parameter Name="original_text" Type="String"></asp:Parameter>
</UpdateParameters>
</asp:SqlDataSource>
</asp:Content>


And this is where I want to get the text form DB and write it in to Label :



using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{


string DatabaseConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString_SQLServer"].ConnectionString;

string text = "SELECT text FROM home WHERE id=1";

using (SqlConnection conn = new SqlConnection(DatabaseConnectionString))
{
conn.Open();
SqlCommand cmd = new SqlCommand(text, conn);
box1_text.Text = (string)cmd.ExecuteScalar();

}
}


}









share|improve this question
















I have a problem and i dont know how to fix it.



I have a simple table in database



CREATE TABLE [dbo].[home] (
[Id] INT NOT NULL,
[text] NTEXT NOT NULL,
PRIMARY KEY CLUSTERED ([Id] ASC)
);


I`m using FormView in visual studio 2012, The FormView is connected with the Home table of the database and there is edit/update/delete options on.



The problem is that when I`m trying to Update the text in te database there is an error



The data types ntext and nvarchar are incompatible in the equal to operator.


A little help please..



This is the code I use to write in the DB :



    <%@ Page Title="" Language="C#" MasterPageFile="~/admin/adminmaster.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="admin_Default" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:FormView ID="FormView1" runat="server" DataKeyNames="Id" DataSourceID="SqlDataSource1">
<EditItemTemplate>
text:
<asp:TextBox Text='<%# Bind("text") %>' runat="server" ID="textTextBox" /><br />
Id:
<asp:Label Text='<%# Eval("Id") %>' runat="server" ID="IdLabel1" /><br />
<asp:LinkButton runat="server" Text="Update" CommandName="Update" ID="UpdateButton" CausesValidation="True" />&nbsp;<asp:LinkButton runat="server" Text="Cancel" CommandName="Cancel" ID="UpdateCancelButton" CausesValidation="False" />
</EditItemTemplate>
<InsertItemTemplate>
text:
<asp:TextBox Text='<%# Bind("text") %>' runat="server" ID="textTextBox" /><br />
Id:
<asp:TextBox Text='<%# Bind("Id") %>' runat="server" ID="IdTextBox" /><br />
<asp:LinkButton runat="server" Text="Insert" CommandName="Insert" ID="InsertButton" CausesValidation="True" />&nbsp;<asp:LinkButton runat="server" Text="Cancel" CommandName="Cancel" ID="InsertCancelButton" CausesValidation="False" />
</InsertItemTemplate>
<ItemTemplate>
text:
<asp:Label Text='<%# Bind("text") %>' runat="server" ID="textLabel" /><br />
Id:
<asp:Label Text='<%# Eval("Id") %>' runat="server" ID="IdLabel" /><br />
<asp:LinkButton runat="server" Text="Edit" CommandName="Edit" ID="EditButton" CausesValidation="False" />&nbsp;<asp:LinkButton runat="server" Text="Delete" CommandName="Delete" ID="DeleteButton" CausesValidation="False" />&nbsp;<asp:LinkButton runat="server" Text="New" CommandName="New" ID="NewButton" CausesValidation="False" />
</ItemTemplate>
</asp:FormView>
<asp:SqlDataSource runat="server" ID="SqlDataSource1" ConflictDetection="CompareAllValues" ConnectionString='<%$ ConnectionStrings:ConnectionString_SQLServer %>' DeleteCommand="DELETE FROM [home] WHERE [Id] = @original_Id AND [text] = @original_text" InsertCommand="INSERT INTO [home] ([Id], [text]) VALUES (@Id, @text)" OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT [Id], [text] FROM [home]" UpdateCommand="UPDATE [home] SET [text] = @text WHERE [Id] = @original_Id AND [text] = @original_text">
<DeleteParameters>
<asp:Parameter Name="original_Id" Type="Int32"></asp:Parameter>
<asp:Parameter Name="original_text" Type="String"></asp:Parameter>
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="Id" Type="Int32"></asp:Parameter>
<asp:Parameter Name="text" Type="String"></asp:Parameter>
</InsertParameters>
<UpdateParameters>
<asp:Parameter Name="text" Type="String"></asp:Parameter>
<asp:Parameter Name="original_Id" Type="Int32"></asp:Parameter>
<asp:Parameter Name="original_text" Type="String"></asp:Parameter>
</UpdateParameters>
</asp:SqlDataSource>
</asp:Content>


And this is where I want to get the text form DB and write it in to Label :



using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{


string DatabaseConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString_SQLServer"].ConnectionString;

string text = "SELECT text FROM home WHERE id=1";

using (SqlConnection conn = new SqlConnection(DatabaseConnectionString))
{
conn.Open();
SqlCommand cmd = new SqlCommand(text, conn);
box1_text.Text = (string)cmd.ExecuteScalar();

}
}


}






c# asp.net sql nvarchar ntext






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 22 '14 at 20:44







user3224399

















asked Jan 22 '14 at 20:35









user3224399user3224399

2613




2613








  • 1





    How are you updating the database info? Could you show that code too?

    – DutGRIFF
    Jan 22 '14 at 20:38











  • I added the code in the main question up there

    – user3224399
    Jan 22 '14 at 20:45











  • You can change the ntext type in database to nvarchar(max). That should resolve the error.

    – Ashish Charan
    Jan 22 '14 at 21:18











  • It Worked ! :) Tnx a lot

    – user3224399
    Jan 23 '14 at 7:53














  • 1





    How are you updating the database info? Could you show that code too?

    – DutGRIFF
    Jan 22 '14 at 20:38











  • I added the code in the main question up there

    – user3224399
    Jan 22 '14 at 20:45











  • You can change the ntext type in database to nvarchar(max). That should resolve the error.

    – Ashish Charan
    Jan 22 '14 at 21:18











  • It Worked ! :) Tnx a lot

    – user3224399
    Jan 23 '14 at 7:53








1




1





How are you updating the database info? Could you show that code too?

– DutGRIFF
Jan 22 '14 at 20:38





How are you updating the database info? Could you show that code too?

– DutGRIFF
Jan 22 '14 at 20:38













I added the code in the main question up there

– user3224399
Jan 22 '14 at 20:45





I added the code in the main question up there

– user3224399
Jan 22 '14 at 20:45













You can change the ntext type in database to nvarchar(max). That should resolve the error.

– Ashish Charan
Jan 22 '14 at 21:18





You can change the ntext type in database to nvarchar(max). That should resolve the error.

– Ashish Charan
Jan 22 '14 at 21:18













It Worked ! :) Tnx a lot

– user3224399
Jan 23 '14 at 7:53





It Worked ! :) Tnx a lot

– user3224399
Jan 23 '14 at 7:53












4 Answers
4






active

oldest

votes


















4














In your query put a convert around any ntext fields to convert them to nvarchar(max)



for example: convert(nvarchar(max), nTextField)






share|improve this answer
























  • Im sorry, Im new at this and I dont know where to put the line of code. In the table but where exactly ? Tnx

    – user3224399
    Jan 22 '14 at 20:59






  • 1





    Place it around the nText fields referenced in your query. "[text] = @original_text" => "convert(nvarchar(max), [text]) = @original_text"

    – Batty McBat
    Jan 22 '14 at 21:03





















0














To avoid getting above exception execute following query in sql server-



Alter table home 
Alter column text nvarchar(max)
GO


I hope my solution is useful for you.






share|improve this answer































    0














    Can Try with LIKE



    For Example



    SELECT * FROM cor.Computer WHERE description LIKE 'HP NOTEBOOK'





    share|improve this answer































      0














      If this is happening to you with DBeaver, it appears if you press 'Cancel' after a failed 'Save', the row will get saved regardless. I guess this is a bug in the software.






      share|improve this answer























        Your Answer






        StackExchange.ifUsing("editor", function () {
        StackExchange.using("externalEditor", function () {
        StackExchange.using("snippets", function () {
        StackExchange.snippets.init();
        });
        });
        }, "code-snippets");

        StackExchange.ready(function() {
        var channelOptions = {
        tags: "".split(" "),
        id: "1"
        };
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function() {
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled) {
        StackExchange.using("snippets", function() {
        createEditor();
        });
        }
        else {
        createEditor();
        }
        });

        function createEditor() {
        StackExchange.prepareEditor({
        heartbeatType: 'answer',
        autoActivateHeartbeat: false,
        convertImagesToLinks: true,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: 10,
        bindNavPrevention: true,
        postfix: "",
        imageUploader: {
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        },
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        });


        }
        });














        draft saved

        draft discarded


















        StackExchange.ready(
        function () {
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f21293406%2fthe-data-types-ntext-and-nvarchar-are-incompatible-in-the-equal-to-operator%23new-answer', 'question_page');
        }
        );

        Post as a guest















        Required, but never shown

























        4 Answers
        4






        active

        oldest

        votes








        4 Answers
        4






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        4














        In your query put a convert around any ntext fields to convert them to nvarchar(max)



        for example: convert(nvarchar(max), nTextField)






        share|improve this answer
























        • Im sorry, Im new at this and I dont know where to put the line of code. In the table but where exactly ? Tnx

          – user3224399
          Jan 22 '14 at 20:59






        • 1





          Place it around the nText fields referenced in your query. "[text] = @original_text" => "convert(nvarchar(max), [text]) = @original_text"

          – Batty McBat
          Jan 22 '14 at 21:03


















        4














        In your query put a convert around any ntext fields to convert them to nvarchar(max)



        for example: convert(nvarchar(max), nTextField)






        share|improve this answer
























        • Im sorry, Im new at this and I dont know where to put the line of code. In the table but where exactly ? Tnx

          – user3224399
          Jan 22 '14 at 20:59






        • 1





          Place it around the nText fields referenced in your query. "[text] = @original_text" => "convert(nvarchar(max), [text]) = @original_text"

          – Batty McBat
          Jan 22 '14 at 21:03
















        4












        4








        4







        In your query put a convert around any ntext fields to convert them to nvarchar(max)



        for example: convert(nvarchar(max), nTextField)






        share|improve this answer













        In your query put a convert around any ntext fields to convert them to nvarchar(max)



        for example: convert(nvarchar(max), nTextField)







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 22 '14 at 20:55









        Batty McBatBatty McBat

        10018




        10018













        • Im sorry, Im new at this and I dont know where to put the line of code. In the table but where exactly ? Tnx

          – user3224399
          Jan 22 '14 at 20:59






        • 1





          Place it around the nText fields referenced in your query. "[text] = @original_text" => "convert(nvarchar(max), [text]) = @original_text"

          – Batty McBat
          Jan 22 '14 at 21:03





















        • Im sorry, Im new at this and I dont know where to put the line of code. In the table but where exactly ? Tnx

          – user3224399
          Jan 22 '14 at 20:59






        • 1





          Place it around the nText fields referenced in your query. "[text] = @original_text" => "convert(nvarchar(max), [text]) = @original_text"

          – Batty McBat
          Jan 22 '14 at 21:03



















        Im sorry, Im new at this and I dont know where to put the line of code. In the table but where exactly ? Tnx

        – user3224399
        Jan 22 '14 at 20:59





        Im sorry, Im new at this and I dont know where to put the line of code. In the table but where exactly ? Tnx

        – user3224399
        Jan 22 '14 at 20:59




        1




        1





        Place it around the nText fields referenced in your query. "[text] = @original_text" => "convert(nvarchar(max), [text]) = @original_text"

        – Batty McBat
        Jan 22 '14 at 21:03







        Place it around the nText fields referenced in your query. "[text] = @original_text" => "convert(nvarchar(max), [text]) = @original_text"

        – Batty McBat
        Jan 22 '14 at 21:03















        0














        To avoid getting above exception execute following query in sql server-



        Alter table home 
        Alter column text nvarchar(max)
        GO


        I hope my solution is useful for you.






        share|improve this answer




























          0














          To avoid getting above exception execute following query in sql server-



          Alter table home 
          Alter column text nvarchar(max)
          GO


          I hope my solution is useful for you.






          share|improve this answer


























            0












            0








            0







            To avoid getting above exception execute following query in sql server-



            Alter table home 
            Alter column text nvarchar(max)
            GO


            I hope my solution is useful for you.






            share|improve this answer













            To avoid getting above exception execute following query in sql server-



            Alter table home 
            Alter column text nvarchar(max)
            GO


            I hope my solution is useful for you.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Jul 2 '15 at 11:31









            ShaileshDevShaileshDev

            572514




            572514























                0














                Can Try with LIKE



                For Example



                SELECT * FROM cor.Computer WHERE description LIKE 'HP NOTEBOOK'





                share|improve this answer




























                  0














                  Can Try with LIKE



                  For Example



                  SELECT * FROM cor.Computer WHERE description LIKE 'HP NOTEBOOK'





                  share|improve this answer


























                    0












                    0








                    0







                    Can Try with LIKE



                    For Example



                    SELECT * FROM cor.Computer WHERE description LIKE 'HP NOTEBOOK'





                    share|improve this answer













                    Can Try with LIKE



                    For Example



                    SELECT * FROM cor.Computer WHERE description LIKE 'HP NOTEBOOK'






                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Aug 10 '17 at 6:28









                    Metin AtalayMetin Atalay

                    713822




                    713822























                        0














                        If this is happening to you with DBeaver, it appears if you press 'Cancel' after a failed 'Save', the row will get saved regardless. I guess this is a bug in the software.






                        share|improve this answer




























                          0














                          If this is happening to you with DBeaver, it appears if you press 'Cancel' after a failed 'Save', the row will get saved regardless. I guess this is a bug in the software.






                          share|improve this answer


























                            0












                            0








                            0







                            If this is happening to you with DBeaver, it appears if you press 'Cancel' after a failed 'Save', the row will get saved regardless. I guess this is a bug in the software.






                            share|improve this answer













                            If this is happening to you with DBeaver, it appears if you press 'Cancel' after a failed 'Save', the row will get saved regardless. I guess this is a bug in the software.







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Nov 15 '18 at 18:44









                            Sridhar-SarnobatSridhar-Sarnobat

                            8,35585560




                            8,35585560






























                                draft saved

                                draft discarded




















































                                Thanks for contributing an answer to Stack Overflow!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid



                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.


                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function () {
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f21293406%2fthe-data-types-ntext-and-nvarchar-are-incompatible-in-the-equal-to-operator%23new-answer', 'question_page');
                                }
                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                Popular posts from this blog

                                Bressuire

                                Vorschmack

                                Quarantine