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 6546269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:41:15+00:00 2026-05-25T11:41:15+00:00

I am writing a DataTable to xml with the DataTable.WriteXml()-method. This takes a few

  • 0

I am writing a DataTable to xml with the DataTable.WriteXml()-method. This takes a few seconds, which I think is very good.

However, reading the file (38MB size, 26000rows, 36 columns) using the ReadXml()-method takes 3 minutes! I am already using the DataTable.BeginLoadData() method before calling the ReadXml (which made it ~10 seconds faster), but is there anything else I can do to improve performance?

Here is the loading method:

            data = new DataTable();
            data.BeginLoadData();
            data.ReadXml(filedialog.FileName);
            data.EndLoadData();

I have used breakpoints and stopwatch to see that it is actually the ReadXml method that is the time consuming part.

Here is the XML scheme:

<?xml version="1.0" standalone="yes"?>
<xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
  <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:MainDataTable="ReportTable" msdata:UseCurrentLocale="true">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="ReportTable">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="Task" type="xs:int" minOccurs="0" />
              <xs:element name="Project" type="xs:string" minOccurs="0" />
              <xs:element name="DP" type="xs:string" minOccurs="0" />
              <xs:element name="Requester" type="xs:string" minOccurs="0" />
              <xs:element name="TaskType" type="xs:string" minOccurs="0" />
              <xs:element name="OriginalMethod" type="xs:string" minOccurs="0" />
              <xs:element name="Method" type="xs:string" minOccurs="0" />
              <xs:element name="Country" type="xs:string" minOccurs="0" />
              <xs:element name="DayPosted" type="xs:string" minOccurs="0" />
              <xs:element name="DayFinished" type="xs:string" minOccurs="0" />
              <xs:element name="Posted" type="xs:dateTime" minOccurs="0" />
              <xs:element name="JustifiedPosted" type="xs:dateTime" minOccurs="0" />
              <xs:element name="Due" type="xs:dateTime" minOccurs="0" />
              <xs:element name="DueInSec" type="xs:double" minOccurs="0" />
              <xs:element name="AvailableDPWorkTime" type="xs:double" minOccurs="0" />
              <xs:element name="AvailableWorkHours" type="xs:string" minOccurs="0" />
              <xs:element name="StartedDate" type="xs:dateTime" minOccurs="0" />
              <xs:element name="FinishDate" type="xs:dateTime" minOccurs="0" />
              <xs:element name="SecUsed" type="xs:double" minOccurs="0" />
              <xs:element name="MinsUsed" type="xs:double" minOccurs="0" />
              <xs:element name="HoursUsed" type="xs:double" minOccurs="0" />
              <xs:element name="TimeUsed" type="xs:string" minOccurs="0" />
              <xs:element name="Month" type="xs:string" minOccurs="0" />
              <xs:element name="Experience" type="xs:int" minOccurs="0" />
              <xs:element name="Delay" type="xs:string" minOccurs="0" />
              <xs:element name="SecDelay" type="xs:int" minOccurs="0" />
              <xs:element name="TimeDelayed" type="xs:string" minOccurs="0" />
              <xs:element name="PostedVsDue" type="xs:string" minOccurs="0" />
              <xs:element name="Modified" type="xs:dateTime" minOccurs="0" />
              <xs:element name="AvailableDPModWorkTime" type="xs:double" minOccurs="0" />
              <xs:element name="ModifiedAvailableWorkHours" type="xs:string" minOccurs="0" />
              <xs:element name="MasterProject" type="xs:string" minOccurs="0" />
              <xs:element name="Year" type="xs:string" minOccurs="0" />
              <xs:element name="Department" type="xs:string" minOccurs="0" />
              <xs:element name="Customer" type="xs:string" minOccurs="0" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:choice>
    </xs:complexType>
  </xs:element>
</xs:schema>
  • 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-25T11:41:15+00:00Added an answer on May 25, 2026 at 11:41 am

    I had same problem long ago, solved by setting EnforceConstraints to false, readXml then set it back to true.

    Try it out.

    Here the docs http://msdn.microsoft.com/en-us/library/s3bxwk8b(v=vs.80).aspx

    EDIT:

    user is loading data into a DataTable directly, suggested also to load data in a stream so to isolate network/disk performance issue from the pure call to data.ReadXml(...);

    ReadXml has aso an overload to read from a stream which could be used after data has been loaded in a Stream.

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

Sidebar

Related Questions

BACKGROUND I'm writing a method that will (eventually) take as input a System.Data.DataTable and
I am writing a unit test for a method which fills an object from
Is there a predefined or easy method of writing a datatable to a text
I am writing my first C# application, which in this case is just a
I'm writing a class that returns both a DataTable and a IEnumerable. I cannot
Writing something like this using the loki library , typedef Functor<void> BitButtonPushHandler; throws a
Writing a test app to emulate PIO lines, I have a very simple Python/Tk
Writing a python program, and I came up with this error while using the
I have a datatable which contains all these records (see SQL query). Instead of
I'm writing an ASP.NET 2.0 page in VS2008. In my Page_Load method I have

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.