title: The data types ntext and nvarchar are incompatible in the equal to operator
body: <p>I have a problem and i dont know how to fix it. </p>
  
  <p>I have a simple table in database </p>
  
  <pre><code>CREATE TABLE [dbo].[home] (
      [Id]   INT   NOT NULL,
      [text] NTEXT NOT NULL,
      PRIMARY KEY CLUSTERED ([Id] ASC)
  );
  </code></pre>
  
  <p>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.</p>
  
  <p>The problem is that when I`m trying to Update the text in te database there is an error </p>
  
  <pre><code>The data types ntext and nvarchar are incompatible in the equal to operator.
  </code></pre>
  
  <p>A little help please..</p>
  
  <p>This is the code I use to write in the DB : </p>
  
  <pre><code>    &lt;%@ Page Title="" Language="C#" MasterPageFile="~/admin/adminmaster.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="admin_Default" %&gt;
  
  &lt;asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"&gt;
  &lt;/asp:Content&gt;
  &lt;asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"&gt;
      &lt;asp:FormView ID="FormView1" runat="server" DataKeyNames="Id" DataSourceID="SqlDataSource1"&gt;
          &lt;EditItemTemplate&gt;
              text:
              &lt;asp:TextBox Text='&lt;%# Bind("text") %&gt;' runat="server" ID="textTextBox" /&gt;&lt;br /&gt;
              Id:
              &lt;asp:Label Text='&lt;%# Eval("Id") %&gt;' runat="server" ID="IdLabel1" /&gt;&lt;br /&gt;
              &lt;asp:LinkButton runat="server" Text="Update" CommandName="Update" ID="UpdateButton" CausesValidation="True" /&gt;&amp;nbsp;&lt;asp:LinkButton runat="server" Text="Cancel" CommandName="Cancel" ID="UpdateCancelButton" CausesValidation="False" /&gt;
          &lt;/EditItemTemplate&gt;
          &lt;InsertItemTemplate&gt;
              text:
              &lt;asp:TextBox Text='&lt;%# Bind("text") %&gt;' runat="server" ID="textTextBox" /&gt;&lt;br /&gt;
              Id:
              &lt;asp:TextBox Text='&lt;%# Bind("Id") %&gt;' runat="server" ID="IdTextBox" /&gt;&lt;br /&gt;
              &lt;asp:LinkButton runat="server" Text="Insert" CommandName="Insert" ID="InsertButton" CausesValidation="True" /&gt;&amp;nbsp;&lt;asp:LinkButton runat="server" Text="Cancel" CommandName="Cancel" ID="InsertCancelButton" CausesValidation="False" /&gt;
          &lt;/InsertItemTemplate&gt;
          &lt;ItemTemplate&gt;
              text:
              &lt;asp:Label Text='&lt;%# Bind("text") %&gt;' runat="server" ID="textLabel" /&gt;&lt;br /&gt;
              Id:
              &lt;asp:Label Text='&lt;%# Eval("Id") %&gt;' runat="server" ID="IdLabel" /&gt;&lt;br /&gt;
              &lt;asp:LinkButton runat="server" Text="Edit" CommandName="Edit" ID="EditButton" CausesValidation="False" /&gt;&amp;nbsp;&lt;asp:LinkButton runat="server" Text="Delete" CommandName="Delete" ID="DeleteButton" CausesValidation="False" /&gt;&amp;nbsp;&lt;asp:LinkButton runat="server" Text="New" CommandName="New" ID="NewButton" CausesValidation="False" /&gt;
          &lt;/ItemTemplate&gt;
      &lt;/asp:FormView&gt;
      &lt;asp:SqlDataSource runat="server" ID="SqlDataSource1" ConflictDetection="CompareAllValues" ConnectionString='&lt;%$ ConnectionStrings:ConnectionString_SQLServer %&gt;' 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"&gt;
          &lt;DeleteParameters&gt;
              &lt;asp:Parameter Name="original_Id" Type="Int32"&gt;&lt;/asp:Parameter&gt;
              &lt;asp:Parameter Name="original_text" Type="String"&gt;&lt;/asp:Parameter&gt;
          &lt;/DeleteParameters&gt;
          &lt;InsertParameters&gt;
              &lt;asp:Parameter Name="Id" Type="Int32"&gt;&lt;/asp:Parameter&gt;
              &lt;asp:Parameter Name="text" Type="String"&gt;&lt;/asp:Parameter&gt;
          &lt;/InsertParameters&gt;
          &lt;UpdateParameters&gt;
              &lt;asp:Parameter Name="text" Type="String"&gt;&lt;/asp:Parameter&gt;
              &lt;asp:Parameter Name="original_Id" Type="Int32"&gt;&lt;/asp:Parameter&gt;
              &lt;asp:Parameter Name="original_text" Type="String"&gt;&lt;/asp:Parameter&gt;
          &lt;/UpdateParameters&gt;
      &lt;/asp:SqlDataSource&gt;
  &lt;/asp:Content&gt;
  </code></pre>
  
  <p>And this is where I want to get the text form DB and write it in to Label : </p>
  
  <pre><code>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();
  
              }
          }
  
  
  }
  </code></pre>