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

  • SEARCH
  • Home
  • 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 6248083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:59:33+00:00 2026-05-24T12:59:33+00:00

is it possible to use a datacontext or LINQ when you have an XML

  • 0

is it possible to use a datacontext or LINQ when you have an XML field? we succeed in updating the xml field in but once it is in the db, we cannot update any other fields due to the above error. we tried setting the (UpdateCheck=UpdateCheck.Never) on the Entity but this just means the xml won’t even insert. Are there any ways around this or options we are missing?

the table is the below

CREATE TABLE [Header]
(
    ID int NOT NULL IDENTITY (1, 1),
    FileName varchar(50) NOT NULL,
    XMLData xml NOT NULL,
    StatusID int NOT NULL,
    TypeID int NOT NULL,
    CreatedDate DateTime NOT NULL Default getdate(),
    LastUpdatedDate DateTime NOT NULL Default getdate()
)  ON [PRIMARY]

the entity, when we tried adding (UpdateCheck=UpdateCheck.Never) it never even inserted the xml.

[Table(Name = "Header")]
public class HeaderEntity
{
    [Column(IsPrimaryKey = true, IsDbGenerated = true)]
    public int ID { get; set; }
    [Column]
    public String FileName { get; set; }
    [Column]
    public XDocument XMLData { get; set; }
    [Column]
    public int StatusID { get; set; }
    [Column]
    public int TypeID { get; set; }
    [Column]
    public DateTime LastUpdatedDate { get; set; }
}

this method works, but the xmldata is empty and this method adds it.

    public void UploadHeaderXML(HeaderEntity HeaderEntityNew)
    {
        String ConnectionString = ConfigurationManager.ConnectionStrings["DB"].ConnectionString;
        var dataContext = new DataContext(new SqlConnection(ConnectionString));

        HeaderEntity HeaderEntitytoUpdate = dataContext.GetTable<HeaderEntity>().Single(p => p.ID == HeaderEntityNew.ID);
        HeaderEntitytoUpdate.XMLData = HeaderEntityNew.XMLData;

        dataContext.SubmitChanges();
    }

This method gives the error Linq to SQL error SQL does not compare Xml.

    public void UpdateAudit(Int32 ID, Int32 auditID)
    {
        String ConnectionString = ConfigurationManager.ConnectionStrings["DB"].ConnectionString;
        var dataContext = new DataContext(new SqlConnection(ConnectionString));

        HeaderEntity HeaderEntitytoUpdate = dataContext.GetTable<HeaderEntity>().Single(p => p.ID == ID);
        HeaderEntitytoUpdate.StatusID = auditID;

        dataContext.SubmitChanges();
    }
  • 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-24T12:59:33+00:00Added an answer on May 24, 2026 at 12:59 pm

    Changing the Update to update the xml worked. If there is a tidier solution though, i would accept that as an answer.

        public void UpdateAudit(Int32 rpaID, Int32 auditID)
        {
            String ConnectionString = ConfigurationManager.ConnectionStrings["RPADB"].ConnectionString;
            var dataContext = new DataContext(new SqlConnection(ConnectionString));
    
            RPAHeaderEntity RPAHeaderEntitytoUpdate = dataContext.GetTable<RPAHeaderEntity>().Single(p => p.RPAID == rpaID);
            RPAHeaderEntitytoUpdate.RPAStatusID = auditID;
            RPAHeaderEntitytoUpdate.XMLData = new XDocument(RPAHeaderEntitytoUpdate.XMLData);**
    
    
            dataContext.SubmitChanges();
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Linq help - Sql trace returns result, but datacontext returning null Question
First, a little background. I have a DataContext object (Linq to SQL). I use
I have recently started looking into Google Charts API for possible use within the
Is it possible to get a LINQ to SQL DataContext to run completely in-memory?
I'm not sure if this is possible, but I'm trying to use the C#
I currently have a LINQ query implemented as a method of my DataContext class.
Is it possible to use the DataContext class to connect to an Oracle DB?
Is it possible use mod_rewrite to resolve addresses hosted on another server? Say I
Possible Duplicate: Use SVN Revision to label build in CCNET I'm working through the
Is possible to use ArcSDE API in .NET(C#) ? http://edndoc.esri.com/arcsde/9.2/api/capi/dbconnects/dbconnects.htm Thanks

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.