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
732 Views

Similar Articles

[PageSpeed] 52

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 (275)
6/20/2005 8:36:05 AM
Reply:

Similar Artilces:

Save graph formatting
I have formatted my pivot graph but every time I refresh or change the pivot, the graph reverts back to a different default. I have saved it as a default graph. Have you tried unclicking the checkbox for 'AutoFormat table' in the PivotTable Options window? -- Hope this helps. If it does, please click the Yes button. Thanks in advance for your feedback. Gary Brown "Teresa" wrote: > I have formatted my pivot graph but every time I refresh or change the pivot, > the graph reverts back to a different default. I have saved it as a default >...

Empty the Inbox
Is there a better way to empty all messages in the Inbox than holding down the Cntrl key? Just used the laptop after several months, and it downloaded all the old emails on the server. Using Windows Outlook Express. -- kbob This is not the Outlook Express newsgroup, but anyway: If you want to delete all the Inbox messages, highlight one header viewing in the Preview Pane, and Ctrl + A will highlight them all. Delete all in one motion. -- Bruce Hagen MS-MVP [Mail] Imperial Beach, CA "k. bob" <kbob@discussions.microsoft.com> wrot...

can not save office2000 files with new name over network
My pc is running Win XP. In MS Word and MS Excel (office 2000) I can open files over network from win98 machines. I can also make changes and save. However, if I try to save with a new name I get the message: The folder (filename with network address) isn't accessible. The folder may be located on an unavailable volume or protected with a password. I have downloaded all service packs. I can find the file using windows explorer and rename it over the network. The problem only seems to occur from my XPpro PC using the MS office programs - pretty inconvenient through! Anyone help? If ...

Select table to query
I have some tables that are named according to the date they are created e.g. 20080101TABLE, 20080215TABLE… and so on. The field names on these tables are exactly the same. Currently I’m building a query to analyze every table but I want to make this procedure faster. Before I run the query I would like to select the table I’m interested. How can I achieve this? My access skills are quite limited but if someone could give an example or some guidance I think I would be able to achieve it. Thanks in advance. Add a field for date and combine your tables into one. You will not need to c...

Tables?
Probably confusion on my part, but I can't figure out how to do standard tables in Visio-- you know, the typical table such as is found in Word, Puiblisher, Frontpage, et al. There are table-type shapes, to be sure, but the ones I've tried have suffered one limitation or another. I just need a good-old fashioned table that can have cells split, merged, shaded, inserted, etc. Note: the Help in Visio 2003 beta only pulls up references to database tables-- not what I need. Thanks all, Randall Arnold Thanks for the feedback. Yes, the Help should have more than database tables in i...

Creating Football League Tables
I work for a premier football club, and wish to put results in to a format so that position and points can be updated at home showing league position week by week Cheers See http://www.xldynamic.com/source/xld.LeagueTable.html -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Andy" <Andy@discussions.microsoft.com> wrote in message news:B16ACC8D-EC8A-4B75-ADDF-77EC37F9D948@microsoft.com... >I work for a premier football club, and wish to put results in to a format >so > that position and points can be updated at home...

Looping until empty column
Here is my dilemma. I can do VBA in Access, but for some reason I jus don't get it in excel. What I want to do is go down a column and stor that info in a variable. I want this to happen untill there is no mor data. Once I have that data I want to go to another page and store th data in an empty column. I want the program to auto. find the empt column. Thank You in advance. thegu -- thegu ----------------------------------------------------------------------- theguz's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=2491 View this thread: http://www.excelforum....

DataSet.ReadXmlSchema chokes on uddi_v3.xsd
I am trying to read the standard UDDI schema using a DataSet. however, it always chokes with error. Here are the full details: Schema used: http://uddi.org/schema/uddi_v3.xsd C# (.NET) calls made: public readonly DataSet Schema; Schema = new DataSet(); Schema.ReadXmlSchema(this.SchemaFile); Following exception is returned: System.Data.DataException: Undefined data type: 'validationTypeString4096'. at System.Data.XSDSchema.FindNameType(String name) at System.Data.XSDSchema.HandleSimpleContentColumn(String strType, DataTable table, Boolean isBase, XmlAttribute[] attrs, ...

pst file appears empty
Hello all! I have a 450 MB pst file, that appears empty in OL98. I have run scanpst several times, did not help. I changed the first byte of the file from 21 to 00 with a hex editor and ran scanpst, it did report errors, fixed them and still no help. I tried exmerge, which reported succesful import, but did not actually retrieve anything from the pst file. Mdbvu32 also shows that the stuff is in there. It seems that the problem is quite common, but does anyone have a solution, how to fix it. Please help! Harri ...

How to join various tables with the same KeyField
I have data in multiple tables, and the tables have the same Keyfield. I am not able to find any script to write the procedure for joining the multiple tables and run the report. Any suggestions please? Appreciate it very much. Thanks. Pers. I created a Virtual Table to access data from various tables with same Key Field. I used the Equal Join. I have one Primary table and one secondary table. Everything works fine when I compile it. But when i run in the test mode, it gives an error saying "An open operation on virtual table failed accessing SQL data. Do anyone have solution ...

Empty Cell not empty
If I use the following formula: =IF(B25="","",B25+C25) in Column U all the way down to Row 20000 to create a new value... (Column B has a date and Column C has a Time) and then copy and paste Column U to Column T as values, I see empty cells in Column T once my data runs out (presently around Row 40. However....if I use the CountA function,it is telling me that I have data in Column T all the way down to Row 20000. Since this combined Date/Time is being used as X Axis data it is screwing up the graph because Excel thinks those cells are Jan 1, 1900 when in fact...

Refreshing a Pivot table
Hi all I need some help with creating a hyperlink type button to refresh pivot table. Any help with this will be extremely appreciated Many thanks Yusu -- Message posted from http://www.ExcelForum.com The following code will autmatically refresh a pivot table when yo select the worksheet that contains the pivot table and fit the column to the correct size. Code ------------------- Private Sub Worksheet_Activate() Set pvtTable = Worksheets("Sheet1").Range("A3").PivotTable pvtTable.RefreshTable Worksheets("Sheet1").Range("C:P").Colu...

XML to DataSet to SQLServer 2000
We are working on a project that has a relatively complex XML file (has many nested elements etc.) - it's pretty straightforward to load it into a dataset and display thru a datagrid but how does one "save" it into a sqlserver 2000 database. For arguments sake, lets assume I'm looking for a utility that would take the XML document, infer a schema (including relationships) check if the table(s) exist, if not create the table, and then save the data - if the table exists of course it would append... Any pointers on how I should proceed... I've looked at SQLXML, OpenXML, D...

Correct table set up for later calculations
Thanks in Advance! I am planning a simple entry form and database that will store ratings of the same product by multiple raters. I will later want to calculate simple percentages or average ratings for the products, and build a simple report that shows these results (I have questions about this too, but I'll save them till after this one is answered) I'm a bit muddled as to whether a "record" should represent a rater or whether a record should represent a product. In other words, should the table look like the first example or the second below? Produ...

Empty Excel file is too large
I have deleted all sheets, and contents from my excel file, but it's still 2Meg in size. When I zip it, it's only 90K Bytes. (A blank excel file is usually 90K Bytes) Why is my empty file so large? It was originally 5 Meg, and I deleted all sheets, formulas, and VB codes. Right now there is nothing (except one empty sheet), but the size is still 2M. Please respond. Sometimes what I find is that Excel counts unused rows as part of the file size. So what I do is highlight all the rows from the first unused one to the last one, i.e. ctrl+g to bring up the goto box, then Ax:a65536,...

Pivot Tables in Excel 2002: lost "Label and Data" functionality?
I was just upgraded from Office 97 to XP, and am having a terrible time making my pivot tables work the way they used to in Excel 97. Here are some of the issues: - The "Label," "Data" and "Label and Data" buttons in the Pivot Table toolbar are not permanently active in this version. I have to go to "Pivot Table/Select/Enable Selection" and click "Enable Selection," and even then I must click on "Enable Selection" twice to get them to be active. This is a major problem. - Because the Label and Data toolbar buttons are not active, I a...

Creating an automatic Table of Contents
Version: 2004 Operating System: Mac OS X 10.5 (Leopard) Hi <br><br>There used to be a way to create a Table of Contents for an article or a book that when ever I changed or added something, the Table of Contents would automatically repaginate itself and show the correct (new) page numbers for the headings, maps, tables etc. What happened to that feature? Does anyone know? <br><br>Clarence Hi Clarence: Still there, same as always. It was never "Automatic". You have to click in the Table of Contents and hit F9 to provoke an update. Some people set...

Exporting from XMLReader to an XML file
Hello, I have an XmlReader object containg some Xml code. I would like to export this document from the reader to an Xml file. How to do this? Thanks for any hints, Leszek Taratuta Below there is the code I'm using: string myXmlQuery = "SELECT 1 AS Tag, NULL AS Parent, [Filename] AS [Content!1!Filename!element], [Caption] AS [Content!1!Caption!element], [Content] AS [Content!1!!CDATA] FROM Content FOR XML EXPLICIT"; SqlConnection myConnection = new SqlConnection("data source=WEBSERVER;database=myDB;user id=;password=); try { myConnection.Open(); SqlCommand myCommand...

Contacts dialogue box shows up empty
I have an issue with Outlook Pro installed on my main PC that is not recognizing contacts. They are all there, but when I try to send an email, and I select "to" the contacts dialogue box shows up empty. Thanks in advance, Jay Is the Contacts folder selected as an Address List? http://www.howto-outlook.com/faq/contactsinaddressbook.htm -- Robert Sparnaaij [MVP-Outlook] www.howto-outlook.com Tips of the month: -FREE tool; QuickMail. Create new Outlook items anywhere from within Windows -Properly back-up and restore your Outlook data ----- "Jay" <nospam_doctorpep...

PiVot Table Formatting
I have a PiVot Table like this: Product ID Factory Sales 100 A 500 B 500 S 200 100 Total 1200 101 A 500 B 500 S 200 101 Total 1200 I want the the raws with total are in bold font. How can I do it? Thanks in advance. To enable selection -- On the Pivot toolbar, choose PivotTable>Select Click on Enable Selection To format the subtotals -- Move the pointer to the left edge of a subtotal heading in the pivot table. When the black arrow appears (like the one that appears when the pointer is over a row button), click to select all the subtotal rows for that field in the pivot table...

ignoring empty???
Hi all, one of my students presented me with the following: "I get a list from another application. There is a column that has either value "yes" or looks like empty. Now, when I want to jump to the next row that has value "yes" I use the shortcut key Ctrl+ArrowDown. However, sometimes when a cell looks like empty there may be a space, with the result that when I need to jump to the next "yes" cell I end up in a cell that has a space. (one that looks empty) So, I used the function Trim to get rid of all the superfluous spaces in an extra column. And al...

excel graphs data labels in Pivot tables
I have a pivot table, and i have certain events, listed under the comments column that i would like those comments to appear on the graph by the date each major event happened in? ...

empty in box
How do I empty my in box without moving everything to delete first? I can't find a "select all" choice. Can anyone share how to do this? Thanks, Linda Highlight one message header. Ctrl+A will highlight them all. Shift | Delete will bypass Deleted Items. -- Bruce Hagen MS-MVP [Mail] Imperial Beach, CA "Linda" <Linda@discussions.microsoft.com> wrote in message news:EC17754D-E900-4E78-8F3F-766F73CB3410@microsoft.com... > How do I empty my in box without moving everything to delete first? I > can't > f...

Concatenate two columns in a table or IF statement?
I have a table that has a provider # column and then a provider name column. In order to get my drop down list to appear correctly for our users on the main form, I created a query that added the provider # and name together. However, when I do this, of course my reports do not work properly now. The report prompts me for a provider #, which is now missing by its self. Is there a way to leave what the user sees, as the combined name and number, but something like an "if" provider # and name is this, then give me the provider # only somewhere else that I can pull for my report?Any...

Linked Table to Outlook contacts
Hi group, Please bear with me if this is a wrong forum for the question: I have created a linked Table to the contacts in my outlook. The issue is that the linked table does not contain links to all the fields that are available on the Outlook Calendar form. I am using Outlook 2003 and Access 2003 to map to outlook. I am trying to develop a web application that can use my address to add / update my phonebook based upon my business rules. Is there any way in Access, that I can specify, which fields to link to (if not all) to an external data source (Outlook contacts in this case). ...