The data types ntext and nvarchar are incompatible in the equal to operator
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" /> <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" /> <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" /> <asp:LinkButton runat="server" Text="Delete" CommandName="Delete" ID="DeleteButton" CausesValidation="False" /> <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
add a comment |
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" /> <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" /> <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" /> <asp:LinkButton runat="server" Text="Delete" CommandName="Delete" ID="DeleteButton" CausesValidation="False" /> <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
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
add a comment |
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" /> <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" /> <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" /> <asp:LinkButton runat="server" Text="Delete" CommandName="Delete" ID="DeleteButton" CausesValidation="False" /> <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
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" /> <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" /> <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" /> <asp:LinkButton runat="server" Text="Delete" CommandName="Delete" ID="DeleteButton" CausesValidation="False" /> <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
c# asp.net sql nvarchar ntext
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
add a comment |
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
add a comment |
4 Answers
4
active
oldest
votes
In your query put a convert around any ntext fields to convert them to nvarchar(max)
for example: convert(nvarchar(max), nTextField)
Im sorry, I
m 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
add a comment |
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.
add a comment |
Can Try with LIKE
For Example
SELECT * FROM cor.Computer WHERE description LIKE 'HP NOTEBOOK'
add a comment |
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.
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
In your query put a convert around any ntext fields to convert them to nvarchar(max)
for example: convert(nvarchar(max), nTextField)
Im sorry, I
m 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
add a comment |
In your query put a convert around any ntext fields to convert them to nvarchar(max)
for example: convert(nvarchar(max), nTextField)
Im sorry, I
m 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
add a comment |
In your query put a convert around any ntext fields to convert them to nvarchar(max)
for example: convert(nvarchar(max), nTextField)
In your query put a convert around any ntext fields to convert them to nvarchar(max)
for example: convert(nvarchar(max), nTextField)
answered Jan 22 '14 at 20:55
Batty McBatBatty McBat
10018
10018
Im sorry, I
m 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
add a comment |
Im sorry, I
m 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
I
m sorry, I
m 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
I
m sorry, I
m 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
add a comment |
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.
add a comment |
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.
add a comment |
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.
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.
answered Jul 2 '15 at 11:31
ShaileshDevShaileshDev
572514
572514
add a comment |
add a comment |
Can Try with LIKE
For Example
SELECT * FROM cor.Computer WHERE description LIKE 'HP NOTEBOOK'
add a comment |
Can Try with LIKE
For Example
SELECT * FROM cor.Computer WHERE description LIKE 'HP NOTEBOOK'
add a comment |
Can Try with LIKE
For Example
SELECT * FROM cor.Computer WHERE description LIKE 'HP NOTEBOOK'
Can Try with LIKE
For Example
SELECT * FROM cor.Computer WHERE description LIKE 'HP NOTEBOOK'
answered Aug 10 '17 at 6:28
Metin AtalayMetin Atalay
713822
713822
add a comment |
add a comment |
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.
add a comment |
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.
add a comment |
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.
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.
answered Nov 15 '18 at 18:44
Sridhar-SarnobatSridhar-Sarnobat
8,35585560
8,35585560
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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