Export from MS Access to XML using VB.NET 2005

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dipalipatel
    New Member
    • Nov 2008
    • 21

    Export from MS Access to XML using VB.NET 2005

    Hi,

    I have one Access database with one table ForExample: MYTable with fields called Type, Version, data, Value.
    now i would like to create an XML file with this MYTable value using VB.NET 2005.

    For example:
    Code:
     
    <MYTable>
     
    <Type>H</Type>
    <Version>2.2</Version>
    <data> </data>
     
    <Type>D</Type>
    <Version> </Version>
    <Data>4000</Data>
    <Value>1</Value>
     
    <Type>D</Type>
    <Version> </Version>
    <Data>5000</Data>
    <Value>2</Value>
     
    </MYTable>
    But here if i donot have any value entered for spefic column it wont appear on that node.
    for Example in first row "Value" tag is not there becase theere is no data in that field for that row.
    but if i inserted blank value to that field it should appear there for example "Version" tag on 2nd and 3rd node

    Please, Can any one help me with this?

    Thanks in advance.
  • Dököll
    Recognized Expert Top Contributor
    • Nov 2006
    • 2379

    #2
    Greetings!

    I am going to add to the .NET area for further support.

    Hope you get this one nailed somehow.

    Later!

    Comment

    • balabaster
      Recognized Expert Contributor
      • Mar 2007
      • 798

      #3
      What version of Access are you running? I'm running 2007 and the easiest way is to right click the table in Access and choose Export -> XML File. You will run through a bunch of options and then your table is saved out as an XML file. Done... and all without opening Visual Studio.

      In Access 2003/2002(XP) you can choose the export option from the File menu and do the same thing.

      I don't recall if 2000 had this option, but a quick search on Google didn't reveal anything telling which suggests it didn't.

      Comment

      • dipalipatel
        New Member
        • Nov 2008
        • 21

        #4
        Hi Thanks for your reply.

        But i have to do in VB.NET 2005 this things. I already got the solution how to create an xml file from this bytes forum using ds.loadxml(file name).

        But the problem is if i insert blank spaces then in xml it's not showing that.
        For example:
        if i want <item>123 </item> then in xml it showing <item>123<item> .
        So, basically it is trimiing all whitespaces.

        Same way if i want <name> </name> then it's showing me <name />

        So, is there any way to keep whitespaces when we load xml file??

        Can you help me with this?

        Thanks

        Comment

        Working...