<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://msmvps.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Office Systems Developer : .NET With Microsoft Office</title><link>http://msmvps.com/blogs/officept/archive/tags/.NET+With+Microsoft+Office/default.aspx</link><description>Tags: .NET With Microsoft Office</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP2 (Build: 40407.4157)</generator><item><title>Export a Table From Office 2007 Beta 2 as XML and Read it in Visual Studio whit a DataSet</title><link>http://msmvps.com/blogs/officept/archive/2006/08/29/Export-a-Table-From-Office-2007-Beta-2-as-XML-and-Read-it-in-Visual-Studio-whit-a-DataSet.aspx</link><pubDate>Mon, 28 Aug 2006 23:13:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:110712</guid><dc:creator>Joao Livio</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/officept/rsscomments.aspx?PostID=110712</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/officept/commentapi.aspx?PostID=110712</wfw:comment><comments>http://msmvps.com/blogs/officept/archive/2006/08/29/Export-a-Table-From-Office-2007-Beta-2-as-XML-and-Read-it-in-Visual-Studio-whit-a-DataSet.aspx#comments</comments><description>&lt;div style="padding:10px;"&gt;&lt;font face="Tahoma" size="2"&gt;&lt;p&gt;&lt;u&gt;Please do not forget&amp;nbsp;at the time this post OFFICE 2007 is still in &lt;strong&gt;STAGE&lt;/strong&gt; &lt;strong&gt;BETA&lt;/strong&gt;.&lt;/u&gt;&lt;/p&gt;&lt;p&gt;&lt;u&gt;My intention with this post is&amp;nbsp;to provide a quick workaround to the issue&lt;/u&gt;&amp;nbsp;&lt;/p&gt;&lt;/font&gt;&lt;/div&gt;&lt;div style="padding:10px;"&gt;&lt;font face="Tahoma" size="2"&gt;For this Article you can download free the bellow Tools&lt;/font&gt;&lt;/div&gt;&lt;div style="padding:10px;"&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font face="Tahoma" size="2"&gt;Visual Studio Express edition&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;a href="http://msdn.microsoft.com/vstudio/express/"&gt;&lt;font face="Tahoma" size="2"&gt;http://msdn.microsoft.com/vstudio/express/&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font face="Tahoma" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font face="Tahoma" size="2"&gt;Office 2007 Beta 2&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;a href="http://www.microsoft.com/office/preview/beta/download/en/default.mspx"&gt;&lt;font face="Tahoma" size="2"&gt;http://www.microsoft.com/office/preview/beta/download/en/default.mspx&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;div style="padding:10px;"&gt;&lt;strong&gt;&lt;font face="Tahoma" size="2"&gt;INTRODUCTION&lt;/font&gt;&lt;/strong&gt;&lt;/div&gt;&lt;div style="padding:10px;"&gt;&lt;font face="Tahoma" size="2"&gt;In this section we are going to see as to export of the Access 2007 Beta 2 the Table Customers to XML and to import the same one in the same format without SCHEMA, Pure XML to a DATASET into Visual&amp;nbsp;Studio. I am going to use the Visual Studio&amp;nbsp;2005 Professional provided for the MSDN that&amp;nbsp;is&amp;nbsp;exacly for test proposes. I go to export the filing-cabinet to XML, chose the Customers Table of the Database NORTHWIND of&amp;nbsp; Microsoft, I go to choose PROVIDER XML with the Right Button of the mouse, as it is I demonstrate in (Figure 1)&lt;/font&gt;&lt;/div&gt;&lt;div style="padding:10px;"&gt;&lt;font face="Tahoma" size="2"&gt;&lt;img border="0" height="271" src="http://officept.mvps.org/images2/XMLVS1.jpg" width="458" alt="" /&gt;&lt;/font&gt;&lt;/div&gt;&lt;div style="padding:10px;"&gt;&lt;font face="Tahoma" size="2"&gt;Figure&amp;nbsp;1&lt;/font&gt;&lt;/div&gt;&lt;div style="padding:10px;"&gt;&lt;font face="Tahoma" size="2"&gt;We go to choose the place for writing of our filing-cabinets. You do not modify the name of&amp;nbsp;file XML as demonstrated in Figure 2 because it goes to be used&amp;nbsp;bellow with the name for Default.&lt;/font&gt;&lt;/div&gt;&lt;div style="padding:10px;"&gt;&lt;font face="Tahoma" size="2"&gt;&lt;img border="0" height="337" src="http://officept.mvps.org/images2/XMLVS2.jpg" width="466" alt="" /&gt;&lt;/font&gt;&lt;/div&gt;&lt;div style="padding:10px;"&gt;&lt;font face="Tahoma" size="2"&gt;Figure&amp;nbsp;2&lt;/font&gt;&lt;/div&gt;&lt;div style="padding:10px;"&gt;&lt;font face="Tahoma" size="2"&gt;You select the options that you want, in this in case that I am&amp;nbsp;going to include the&amp;nbsp;SCHEMA (Figure 3), filing-cabinet XSD and Filing-cabinet XML, but I do not go to&amp;nbsp;need of filing-cabinet XSD. The same&amp;nbsp;would be&amp;nbsp;useful for a detailed use of the ROWS in way of structure of the Table, but in this in case that we only go to need the data exactly.&lt;/font&gt;&lt;/div&gt;&lt;p&gt;&lt;font face="Tahoma" size="2"&gt;&lt;img border="0" height="151" src="http://officept.mvps.org/images2/XMLVS3.jpg" width="316" alt="" /&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font face="Tahoma" size="2"&gt;Figure 3&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font face="Tahoma" size="2"&gt;Now You open the Visual Studio .NET 2005 and create a new Application Windows Form, gives to a name any (Figure 4)&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font face="Tahoma" size="2"&gt;&lt;img border="0" height="278" src="http://officept.mvps.org/images2/XMLVS5.jpg" width="448" alt="" /&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font face="Tahoma" size="2"&gt;Figure 4&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font face="Tahoma" size="2"&gt;After&amp;nbsp;your Application is created(Figure 5) you go to execute two&amp;nbsp;operations &lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font face="Tahoma" size="2"&gt;1. you insert a CommandButton1 in the Form1 and Handle CLICK and place the code in low. &lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font face="Tahoma" size="2"&gt;2. IT PASSES FILING-CABINET XML for its folder MY DOCUMENTS because i formated the code to read it there&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font face="Tahoma" size="2"&gt;&lt;img border="0" height="347" src="http://officept.mvps.org/images2/XMLVS6.jpg" width="428" alt="" /&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font face="Tahoma" size="2"&gt;Figure 5&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;strong&gt;&lt;font face="Tahoma" size="2"&gt;CODE&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;strong&gt;&lt;font face="Tahoma"&gt;&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;strong&gt;&lt;font face="Tahoma"&gt;&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;strong&gt;&lt;font face="Tahoma"&gt;&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font face="Tahoma" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font face="Tahoma" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;strong&gt;&lt;font face="Tahoma" size="2"&gt;VB&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font face="Tahoma" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;font color="#0066cc" face="Tahoma" size="2"&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font color="#0066cc" face="Tahoma" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font color="#0066cc" face="Tahoma" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font color="#0066cc" face="Tahoma" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font color="#0066cc" face="Tahoma" size="2"&gt;Imports System&lt;/font&gt;&lt;/p&gt;&lt;/font&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font color="#0066cc" face="Tahoma" size="2"&gt;Imports System.Data&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font color="#0066cc" face="Tahoma" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font color="#0066cc" face="Tahoma" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font color="#0066cc" face="Tahoma" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font color="#0066cc" face="Tahoma" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font color="#0066cc" face="Tahoma" size="2"&gt;Dim myDocumentsFolder As String&lt;br /&gt;myDocumentsFolder = _&lt;br /&gt;System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)&lt;br /&gt;Dim DataSet1 As New DataSet&lt;br /&gt;DataSet1.ReadXml(myDocumentsFolder &amp;amp; &amp;quot;\Customers.xml&amp;quot;)&lt;br /&gt;&lt;br /&gt;MessageBox.Show(DataSet1.Tables(1).Rows.Count.ToString)&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font color="#0066cc" face="Tahoma"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font face="Tahoma" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;strong&gt;&lt;font face="Tahoma" size="2"&gt;&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;strong&gt;&lt;font face="Tahoma" size="2"&gt;&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;strong&gt;&lt;font face="Tahoma" size="2"&gt;&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;strong&gt;&lt;font face="Tahoma" size="2"&gt;C#&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;strong&gt;&lt;font face="Tahoma" size="2"&gt;&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font color="#0066cc" face="Tahoma" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font color="#0066cc" face="Tahoma" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font color="#0066cc" face="Tahoma" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font color="#0066cc" face="Tahoma" size="2"&gt;using&amp;nbsp;System&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font color="#0066cc" face="Tahoma" size="2"&gt;using&amp;nbsp;System.Data&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font face="Tahoma" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font color="#0066cc" face="Tahoma" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font color="#0066cc" face="Tahoma" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font color="#0066cc" face="Tahoma" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font color="#0066cc" face="Tahoma" size="2"&gt;string myDocumentsFolder; &lt;br /&gt;myDocumentsFolder = _&lt;br /&gt;System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); &lt;br /&gt;DataSet DataSet1 = new DataSet(); &lt;br /&gt;DataSet1.ReadXml(myDocumentsFolder + &amp;quot;\\Customers.xml&amp;quot;); &lt;/font&gt;&lt;/p&gt;&lt;font color="#0066cc"&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;br /&gt;&lt;font face="Tahoma" size="2"&gt;MessageBox.Show(DataSet1.Tables(1).Rows.Count.ToString);&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font face="Tahoma"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font face="Tahoma" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font color="#000000" face="Tahoma" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font color="#000000" face="Tahoma" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font color="#000000" face="Tahoma" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font color="#000000" face="Tahoma" size="2"&gt;It copies then the code for the Handle Click of the CommandButton1 and runs the Application in RELEASE&amp;nbsp;cliking in F5 and&amp;nbsp;and the Button. The waited result is two distinct tables as&amp;nbsp;bellow I explain reason after.&amp;nbsp;As demonstrated in (Figure 6),&amp;nbsp;it returned of 91 Rows (91 lines) of Information. I am&amp;nbsp;reading Table(1) because Table(0) it has the relation for the table for which the Customers Table is related in.&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font color="#000000" face="Tahoma"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font color="#000000" face="Tahoma" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font face="Tahoma" size="2"&gt;&lt;img border="0" height="334" src="http://officept.mvps.org/images2/XMLVS9.jpg" width="439" alt="" /&gt;&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font color="#000000" face="Tahoma" size="2"&gt;Figure 6&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font color="#000000" face="Tahoma"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font face="Tahoma" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font color="#000000" face="Tahoma" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font color="#000000" face="Tahoma" size="2"&gt;To prove that we are to speak exacly of the same information and for foils, I place the line number (Figure 7) removed of a Print Screen of the Customers Table here in Access 2007.&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font color="#000000" face="Tahoma" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font face="Tahoma" size="2"&gt;&lt;img border="0" height="123" src="http://officept.mvps.org/images2/XMLVS8.jpg" width="270" alt="" /&gt;&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font face="Tahoma"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font face="Tahoma" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font color="#000000" face="Tahoma" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font color="#000000" face="Tahoma" size="2"&gt;HOPE THAT HELPES&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font face="Tahoma" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font face="Tahoma" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font color="#000000" face="Tahoma" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font color="#000000" face="Tahoma" size="2"&gt;Agosto/2005&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font color="#000000" face="Tahoma" size="2"&gt;Joao Livio&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font color="#000000" face="Tahoma" size="2"&gt;Microsoft Office Systems MVP&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-top:0px;margin-bottom:0px;"&gt;&lt;font color="#000000" face="Tahoma" size="2"&gt;&lt;a href="http://officept.mvps.org"&gt;http://officept.mvps.org&lt;/a&gt;&lt;/font&gt;&lt;/p&gt;&lt;/font&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=110712" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/officept/archive/tags/.NET+With+Microsoft+Office/default.aspx">.NET With Microsoft Office</category><category domain="http://msmvps.com/blogs/officept/archive/tags/English+Related/default.aspx">English Related</category></item></channel></rss>