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.


0
pagaley (15)
6/16/2005 7:36:32 PM
dotnet.xml 7266 articles. 0 followers. Follow

2 Replies
954 Views

Similar Articles

[PageSpeed] 30

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" <pagaley@starcalif.com.nospam> wrote in message 
news:%23ck$0qqcFHA.720@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.
>
> 


0
garryfre (5)
6/17/2005 5:18:52 AM
"Phil Galey" <pagaley@starcalif.com.nospam> wrote in message news:%23ck$0qqcFHA.720@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 


0
loresayer (274)
6/20/2005 8:36:05 AM
Reply:

Similar Artilces:

Recovering a file that not saved
Is it possible to recover a excel workbook that was not saved when created? ...

XML Deserialization #3
Hi all Im building an object model so I can deserialize my incoming XML and Ive got a wee problem My incoming XML looks like this .... <Surnames> <Surname>Kelly</Surname> <AlternativeSurnames> <AlternativeSurname>Hill</AlternativeSurname> <AlternativeSurname>Bell</AlternativeSurname> </AlternativeSurnames> </Surnames> .... Have 3 classes - AlternativeSurname, AlternativeSurnamesCollection and Surnames. namespace PROMOD { using System; using System.Xml; using System.Xml.Serialization; [Syste...

Compressing xml file
I am using sharpziplib ti compress & zip an XML file. But the compression ration is very bad for this utility compared to that i do with winzip. Any idea how to integrate winzip with our VB.net application to compress xml files. Or is there any other utility to do the kob Devesh "Devesh Aggarwal" <solutions@unieme.com> schreef in bericht news:#TwLpW8kDHA.1708@TK2MSFTNGP12.phx.gbl... > I am using sharpziplib ti compress & zip an XML file. But the compression > ration is very bad for this utility compared to that i do with winzip. Any > idea how to integrate...

Saving Formatting in Pivot Tables
When I changed formatting in a pivot table, it returns to the default format when I make a change or close the file. Generally, in formats like font size, column width, etc. Is there a way to save/retain format changes in pivot tables? Thank you. right click in the table and go to the bottom to select "table options". It's there. >-----Original Message----- >When I changed formatting in a pivot table, it returns to >the default format when I make a change or close the >file. Generally, in formats like font size, column >width, etc. Is there a way to...

Pivot table and it's macro
I am creating a table and from the table a pivot table using a macro. When I run the macro the table gets created without a problem but when it goes to create the pivot table I get an error and the debugger highlights this section: ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _ "Table8", Version:=xlPivotTableVersion12).CreatePivotTable TableDestination _ :="Perf Tables!R2C8", TableName:="PivotTable1", DefaultVersion:= _ xlPivotTableVersion12 Can anyone see where the problem is happening? My ...

Writing XML File from Dataset
Read many of the posting but still doen't understand the process. I have a dataset with child records. I have a specific XML "Account.XSD" format that I need to write this out to. How do I marry these (2) items to create the output file. Dim dataSet As DataSet = New DataSet("AccountRecord") PremisesAdapter.Fill(dataSet, "Premises") SupAdapter.Fill(dataSet, "Supplemental") cn.Close() Dim AccountRecord As DataRelation = dataSet.Relations.Add("Prem_Species", _ data...

Outlook 2007 & RPC over HTTP
Hello, I think this was discussed some times before but I wasn't able to find a solution. We plan to change our mail provider and use a hosted Exchange environment for our emails. For testing purposes, I signed-up with our desired provider. Everything works fine except saving the passwords in Outlook for the mailbox. I am asked for the password all the time. I already tried the following advices (I know some are addressed to Outlook 2003 etc. but I wanted to give it a try...): http://www.123together.com/Support/save_your_exchange_password_in_outlook2003.htm http://support.microsoft.co...

how do i print a smaller image of my saved document?
I forgot how to do this. My age is taking its toll! Don't blame age, as I don't think Word has any built-in way to do this unless you're thinking of the Zoom feature in the Print dialog, which allows you to print multiple pages per sheet. -- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA http://word.mvps.org "wallyb" <wallyb@discussions.microsoft.com> wrote in message news:8B90FC4B-6B36-4BF0-99C4-8A099673B6EE@microsoft.com... >I forgot how to do this. My age is taking its toll! > ...

Estimating Savings When The Interest Rate Changes Based Upon Savings Amount
I want to design a spreadsheet where I can enter in my estimated savings per year, and it will output my estimated returns, at current interest rates, at the age of 65. The issue arises because the interest rate changes at various savings levels. The details are: $0 - $50000, r=.01 $50001 - $100000, r=.015 $100001 - $125000, r = .0228 $125001 - $150000, r for the first 100000 = .0412, r for the remainder = .01 $150001 - $200000, r for the first 100000 = .0412, r for the remainder = .015 $200001 - $225000, r for the first 100000 = .0412, r for the remainder = .0228 $225001 - $250000, r for t...

address2 fields can not be saved for same account!
Hi Everyone! In my CRM, I input data into Address2 for an exsiting account, then click save and close. But nonthing is saved for address2. Nothing is saved in database. When I create a new account, I can save address2 without any problem. And some existing records in CRM also can save address2. Any help is needed! Thanks Hi, Could be some scripting is misbehaving within the onload/onsave event? Best regards, Merijn "Andrew" wrote: > Hi Everyone! > > In my CRM, I input data into Address2 for an exsiting account, then click > save and close. But nonthing i...

Excel Services Publish
I have a 64 bit client (Windows Server 2008) and my colleague has Windows 7 64 bit client. We are trying to publish an Excel 2007 document to MOSS, which is running under https, and is sitting on a 64 bit operating system. We keep getting the "File Not Saved" error when we try to publish from our clients. However, a 3rd colleague has Windows XP 32 bit and can publish the same exact Excel files just fine up to the very same MOSS location we tried on the 64 bit clients. Can someone from MSFT confirm that this is an issue with 64 bit clients? Can you present a solut...

How do you turn off "Save a copy/Overwrite changes" dialog box
Hello Guys, I have created a (password to open) workbook using Excel 2003 SP1 on a shared network drive which when I try to save by using Ctrl S or clicking the Save icon gives me an irritating dialog box which asks: "The file 'filename.xls' may have been changed by another user since you last saved it. In that case what do you want to do?" -Save a copy -Overwrite changes Please can someone tell me how to deactivate this annoying dialog box as I have been unsuccesful so far in my efforts :confused: Many thanks in advance Nick -- Nicko -----------------------------...

Pivot Table % of
I have a pivot table like the followng: Joe Trans Ct A 5 B 3 C 2 Total Joe 10 Kelly A 6 B 1 C 4 Total Kelly 11 I added another Count of Trans shown as a "% of column", but it gives me the percent of the entire column when what I really want is the % of Total Joe, % of Total Kelly, etc. In this instance I simply made the names go across instead of down which solved the problem, but there are instances where I don't want to do that. Any suggestions for getting the percent per item rather than pe...

SOP Distribution Tables Question
We use eConnect to send SOP transactions with a custom distribution. The distribution can involve transferring some funds from a reserve account, so the distribution can be split, one debit and credit to transfer funds from the reserve account, and the second debit and credit to different accounts, to biill for the remainder. All works fine, and the distributions are correct in the Sales Transaction Distributions window. But we'd like to report off of the tables, and I can only see the one distribution in the SOP10102 table. The second amount and account pair for the reserve amount...

Pivot table row header
Hi, In a pivot table, I have 2 fields in the row section. How can I have the value on the first fields to repeat in every row instead of just showing once? Thanks!! Try Debra Dalgleish's page at: http://www.contextures.com/xlDataEntry02.html Fill Blank Cells Fill Blank Cells Programmatically* [*Sub FillColBlanks() 'by Dave Peterson 2004-01-06] -- Rgds Max xl 97 --- GMT+8, 1� 22' N 103� 45' E xdemechanik <at>yahoo<dot>com ---- "Jason" <Jason@discussions.microsoft.com> wrote in message news:08549CBC-68A7-442E-BABF-D48B11E29479@microsoft.co...

Pivot Table Updates Issue
My Data had a coloum containing stuff like Marketing Department Sales Department Shipping Department I built a bunch of pivot tables on this data. Then I changed the data to read: Marketing Dept Sales Dept Shipping Dept and performed a Refresh Data. Now, on the filter pulldowns on any of the Pivot tables, I see Marketing Department Sales Department Shipping Department Marketing Dept Sales Dept Shipping Dept The first three option no longer exist in any of the data, and I do not want them in the list. How to fix this problem without recreating and reformatting 38 seperate Pivot table...

Last Save Date
I would like to have a cell which displays the date of the last date the file was saved. Is this possible? right click the excel icon just to the left of file>view code>left window workbook>right window>before close range("a1")=date -- Don Guillett SalesAid Software donaldb@281.com "Kurchian" <anonymous@discussions.microsoft.com> wrote in message news:D0B38296-902A-4F6D-9A9C-A4FDFFE505A0@microsoft.com... > I would like to have a cell which displays the date of the last date the file was saved. > > Is this possible? Oops. Before SAVE not clo...

Non-verbose TABLE syntax
I just stumbled upon this (should appeal to the SELECT * fanatics<g>):TABLE Table1, Table2;Apparently valid Jet 4.0 SQL syntax that returns all columns for thecross join of the tables. What do you reckon: OK for production code<g>?Jamie.--...

Find Future Value of a Savings Account
I am trying to set up a spreadsheet that determines the future value of a savings account. Take a look at the FV function in XL Help. In article <EC8EEB72-AF22-47D8-A266-839CA9356725@microsoft.com>, "gingerjane" <gingerjane@discussions.microsoft.com> wrote: > I am trying to set up a spreadsheet that determines the future value of a > savings account. ...

Error when saving
I am trying to save a new file that I created out of a macro. When I g to save the file I get a error message that pops up saying, "Documen Not Saved." Any ideas what could be happening? Thank -- Message posted from http://www.ExcelForum.com ...

I have a question with repeat open and close table
hello,everybody: I write one thread with use Vc6 IDE and I need repeat read data from table , but it had throw error message when my application is runing. Error message is: This application has requested the Runtime to terminate it in an unusual way. please contact the application's support team for mor information�� My segment of code fellow: /* return false if empty data */ bool CReadData::OpenTable() { ASSERT(m_pConn != NULL); //ado connection ASSERT(m_pTable_SMO != NULL); // table try { if (m_pTable_SMO->GetState() & adStateOp...

pivot table : formula to absolute reference a subtotal
hi all. ive been an avid reader of the forums for some time now; time to register so i can post my question, which is rather urgent. (aren't they all ?) the attachment is a simplified version of the pivot table i have going on. the sourcedata is set so the production amount is reported under 'manufacturing', although there are costs in other types. i want to have a 3rd column that would, for each product, do cost of that type / production amount subtotal at each row. so it would basically be cost breakdown at each row, with the total cost at the subtotal level. i cant link to...

create pivot table formula without the GETPIVOTDATA function
Previous to Excel 2003 I could use a pivot table result in a formula and copy that formula as a relative reference. In Excel 2003 a GETPIVOTDATA fromula is created and uses an absolute reference. Is there a way in Excel 2003 to either make it arelative reference (without editing the formula) or revert to the method used in all prior releases? There are instructions here for adding the Generate GetPivotData button to a toolbar, and toggling the feature on and off: http://www.contextures.com/xlPivot06.html ebergkes wrote: > Previous to Excel 2003 I could use a pivot table resu...

French Version of Excel saving CSV Files with a semi-colon
When using a French version of Excel XP I am running into a problem with the save as feature. I am attempting to save a contact list as a comma separated file so users using older versions of office will be able to import the list into outlook. When I try to save the file as a comma separated file it uses a semi-colon instead of a simple comma. I believe this is strictly a language issue and need to know if there is a fix or a setting I can change somewhere. Please help Try changing your windows list separator. windows start button|control panel|regional and language options region...

Likert scale calculation
I have used the following table in my survey: Frequency of use - check which on is applicable: every few hours every few mins every few secs item1 item2 item3 .. .. .. item10 so the sample data looks like this: id item1 item 2 ............. item10 1 hours hrs ................. mins 2 secs hrs ................. mins 3 mins hrs ................. mins I want to add up the hours secs mins for each item..for example (from the above sample): ev...