473,379 Members | 1,355 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Empty Dataset Tables Don't Save to XML

How do you get around the problem of empty tables in a dataset not being
included when you do a WriteXML? When you later read the data back into a
new dataset, those tables are gone, because they never got saved to the XML
file. Only tables containing one or more records get saved to the XML file.
Thanks.
Nov 12 '05 #1
2 4080
I would get around this problem by programatically inserting a fake record
into the tables, then saving the xml, and then just don't save the fake
data.

"Phil Galey" <pa*****@starcalif.com.nospam> wrote in message
news:%2***************@TK2MSFTNGP15.phx.gbl...
How do you get around the problem of empty tables in a dataset not being
included when you do a WriteXML? When you later read the data back into a
new dataset, those tables are gone, because they never got saved to the
XML
file. Only tables containing one or more records get saved to the XML
file.
Thanks.

Nov 12 '05 #2
"Phil Galey" <pa*****@starcalif.com.nospam> wrote in message news:%2***************@TK2MSFTNGP15.phx.gbl...
How do you get around the problem of empty tables in a dataset not being
included when you do a WriteXML? When you later read the data back into a
new dataset, those tables are gone


Use one of the WriteXml( ) method overloads that takes an XmlWriteMode,
specifying XmlWriteMode.WriteSchema:

dataSet1.WriteXml( writer, XmlWriteMode.WriteSchema);

Realize that when there is no data, it can't write content (any content it wrote
would be mistaken for a row of null values, making the DataTable non-empty.)
The only information of value to be persisted is the empty DataTable's schema.

Additionally, ensure the XmlReadMode on ReadXml( ) is Auto or ReadSchema,
and that the MissingSchemaAction on the DataAdapter is Add when rehydrating
the DataSet. (These settings are the defaults.)
Derek Harmon
Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Marty | last post by:
Hi, Ok I use the OLEDBConnector and dataset to retrieve data from my Access DB. I have a problem to read/parse the dataset and I would like to know if I am using the right object to reach my...
2
by: Andreas Palm | last post by:
I have a dataset that has DBNull in certain columns, now when I write out this one to XML, I only get the columns as elements that do have data in it. However I do need also the empty colums as...
0
by: Phil Galey | last post by:
I'm loading tables from an XML file into a dataset. However, if a table has no records, that table doesn't get saved into the XML file. This causes problems when you ReadXML into the dataset and...
6
by: Mike P | last post by:
I have written a simple web service that basically takes a value input by a user and returns a dataset with all related data found in a database. In my client app use this code to get the data...
2
by: Dennis | last post by:
Hi, I am hoping I can get some help with a small problem I have run into using C#. U have an XML file that I load into a Dataset and then display this in a Datagrid. No problems doing this at all....
7
by: Neo Geshel | last post by:
Greetings. I have a serious problem. I have multiple sets of tables, several of which are chained more than two tables deep. That is, I have a parent, a child, and a great-grandchild table. ...
22
by: EMW | last post by:
Hi, I managed to create a SQL server database and a table in it. The table is empty and that brings me to my next chalenge: How can I get the info in the table in the dataset to go in an empty...
9
by: jaYPee | last post by:
I have search a lot of thread in google newsgroup and read a lot of articles but still i don't know how to update the dataset that has 3 tables. my 3 tables looks like the 3 tables from...
0
by: rclarke | last post by:
I am writing an application which needs to save data to a new Jet (MS Access) database. What I would like to clarify is that there is no straightforward way of simply saving an existing DataSet as an...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.