Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7599219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T22:36:30+00:00 2026-05-30T22:36:30+00:00

I am getting a comparison error message when trying to update a record using

  • 0

I am getting a comparison error message when trying to update a record using LINQ.

var tools = from tl in MVCWebsite.MvcApplication.DataContext.tblTools
                                               where tl.pk_fk_Environment == model.Environment
                                               && tl.pk_fk_Classification == model.Classification
                                               && tl.pk_ToolNumber == model.ToolNumber
                                               select tl;
        Models.Database.tblTool updatingTool = tools.First();
        //try
        //{

        if (createPerson(model.ToolEngineer, true) != null)
            updatingTool.fk_Engineer = model.ToolEngineer;
        else
            updatingTool.fk_Engineer = null;

        updatingTool.fk_BuiltBy = model.ToolBuiltBy;

        if (createPerson(model.ToolBuiltBy, true) != null)
            updatingTool.fk_BuiltBy = model.ToolBuiltBy;
        else
            updatingTool.fk_BuiltBy = null;
        if (createPerson(model.ToolDesignedBy, true) != null)
            updatingTool.fk_Designer = model.ToolDesignedBy;
        else
            updatingTool.fk_Designer = null;
        updatingTool.DateOfBuild = model.DateOfBuild;
        updatingTool.Machine_Name_Primary = model.ToolPrimaryMachineName;
        updatingTool.Machine_Description_Primary = model.ToolPrimaryMachineDescription;
        updatingTool.Machine_Name_Secondary = model.ToolSecondaryMachineName;
        updatingTool.Machine_Description_Secondary = model.ToolSecondaryMachineDescription;
        updatingTool.MERNumber = model.MERNumber;
        updatingTool.AssetNumber = model.AssetNumber;
        updatingTool.Additional_Cavities = model.AdditionalFields.Cavities;
        updatingTool.Additional_Gate = model.AdditionalFields.TypeOfGate;
        updatingTool.Additional_Shrinkage = model.AdditionalFields.Shrinkage;
        updatingTool.Additional_DieClearance = model.AdditionalFields.DieClearance;
        updatingTool.Additional_Field1 = model.AdditionalFields.Additional1;
        updatingTool.Additional_Field2 = model.AdditionalFields.Additional2;
        updatingTool.Additional_Field3 = model.AdditionalFields.Additional3;
        updatingTool.Additional_Field4 = model.AdditionalFields.Additional4;
        updatingTool.Additional_OtherInformation = model.AdditionalFields.OtherInformation;

(Below is the create user function)

private Models.Database.tblPerson createPerson(string user)
    {
        if (user == null || user == "")
            return null;
        var people = from p in MVCWebsite.MvcApplication.DataContext.tblPersons
                     where p.pk_PersonID == user
                     select p;
        if (people.Count() == 1)
        {
            return people.First();
        }
        else
        {
            Models.UserInformation ui;
            ui = MVCWebsite.MvcApplication.DisplayUser(user);
            if (!ui.Exists)
                return null;
            tblPerson person = new tblPerson()
            {
                pk_PersonID = user,
                FirstName = ui.GivenName,
                LastName = ui.Surname,
                Email = ui.EmailAddress
            };
            return person;
        }
    }

I am not bothered about if my code is clean or not at the moment, I am just getting this error and it is starting to annoy me.

Here is the Main Table Scripted as a Create (So you can see the field settings:

CREATE TABLE [dbo].[tblTool](
    [pk_fk_Environment] [varchar](2) COLLATE Latin1_General_CI_AS NOT NULL,
    [pk_fk_Classification] [varchar](3) COLLATE Latin1_General_CI_AS NOT NULL,
    [pk_fk_Style] [varchar](4) COLLATE Latin1_General_CI_AS NULL,
    [pk_ToolNumber] [int] NOT NULL,
    [DateOfBuild] [datetime] NULL,
    [fk_Engineer] [varchar](50) COLLATE Latin1_General_CI_AS NULL,
    [fk_Designer] [varchar](50) COLLATE Latin1_General_CI_AS NULL,
    [fk_BuiltBy] [varchar](20) COLLATE Latin1_General_CI_AS NULL,
    [MERNumber] [varchar](50) COLLATE Latin1_General_CI_AS NULL,
    [AssetNumber] [varchar](50) COLLATE Latin1_General_CI_AS NULL,
    [fk_Material] [varchar](50) COLLATE Latin1_General_CI_AS NULL,
    [fk_LocationCompany] [varchar](20) COLLATE Latin1_General_CI_AS NULL,
    [fk_LocationCountry] [varchar](50) COLLATE Latin1_General_CI_AS NULL,
    [fk_LocationRegion] [varchar](50) COLLATE Latin1_General_CI_AS NULL,
    [fk_Status] [varchar](10) COLLATE Latin1_General_CI_AS NULL,
    [Machine_Name_Primary] [varchar](50) COLLATE Latin1_General_CI_AS NULL,
    [Machine_Description_Primary] [text] COLLATE Latin1_General_CI_AS NULL,
    [Machine_Name_Secondary] [varchar](50) COLLATE Latin1_General_CI_AS NULL,
    [Machine_Description_Secondary] [text] COLLATE Latin1_General_CI_AS NULL,
    [OldToolID] [varchar](100) COLLATE Latin1_General_CI_AS NULL,
    [Additional_Cavities] [varchar](50) COLLATE Latin1_General_CI_AS NULL,
    [Additional_Gate] [varchar](50) COLLATE Latin1_General_CI_AS NULL,
    [Additional_Shrinkage] [varchar](50) COLLATE Latin1_General_CI_AS NULL,
    [Additional_DieClearance] [varchar](50) COLLATE Latin1_General_CI_AS NULL,
    [Additional_Field1] [varchar](50) COLLATE Latin1_General_CI_AS NULL,
    [Additional_Field2] [varchar](50) COLLATE Latin1_General_CI_AS NULL,
    [Additional_Field3] [varchar](50) COLLATE Latin1_General_CI_AS NULL,
    [Additional_Field4] [varchar](50) COLLATE Latin1_General_CI_AS NULL,
    [Additional_OtherInformation] [text] COLLATE Latin1_General_CI_AS NULL,
 CONSTRAINT [PK_tblTool] PRIMARY KEY CLUSTERED 
(
    [pk_fk_Environment] ASC,
    [pk_fk_Classification] ASC,
    [pk_ToolNumber] ASC
)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

When updating the field with the same information that is already in it I get the Error:

SQL Server does not handle comparison of NText, Text, Xml, or Image data types.

Does anybody know why this might be happening?

Thanks,
Oliver

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T22:36:31+00:00Added an answer on May 30, 2026 at 10:36 pm

    Change your Additional_OtherInformation, Machine_Description_Primary, and Machine_Description_Secondary columns from the deprecated TEXT datatype to the VARCHAR(MAX) datatype. Refresh your column mappings, and you should be all set.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am getting this error Argument \\x{61} isn't numeric in numeric comparison (<=>) from
Getting a 'marshal data too short' error when trying to install the mysql gem
I'm just learning Cocoa (coming from C#) and I'm getting a strange error for
I'm trying to update a Postgres database to set a boolean but I'm getting
I am trying to write some simple predicate using boost::lambda and I am getting
I am running NTLM using Spring Security, I am getting the following error org.springframework.beans.factory.NoSuchBeanDefinitionException:
I am getting an error while trying to sort a simple array... The ERROR
I'm getting a weird compiler error and as I'm new to using set's with
Getting the subdomain from a URL sounds easy at first. http://www.domain.example Scan for the
Getting started with NHibernate How can I generate identity fields in nHibernate using Hilo

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.