Solved

Programtically Importing  XML into Access Database Tables

Posted on 2008-06-23
8
2,167 Views
Last Modified: 2013-11-29
MS Access 2003 has a great Imprt utility for XML.   I would like to accomplish the same task programtically using C#,   I have search the Google over and never found a true solution.  Does anyone here have specific approach.    

I can easily read the XML into a dataset  but how to get that in MS Access?  
0
Comment
Question by:DylanJones1
  • 4
  • 4
8 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 21849148
You could read the XML into a DataSet, and then import the rows from the XML file into another table that is bound to the Access database, and then update the database.
0
 

Author Comment

by:DylanJones1
ID: 21849329
Yes that is the path I am heading down  I was, of course, hoping for something that would leverage the work that the import feature has already accomplished.     Can you tell me  what I need to do to get my window service to look at its own config file rather than the machine.config?  

This
onfiguration config = ConfigurationManager.OpenExeConfiguration(System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase);

and this
//for testing my service
Configuration config = ConfigurationManager.OpenExeConfiguration(System.Windows.Forms.Application.ExecutablePath)

both bomb out

0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 21849382
What are you trying to get from the config file?
0
 

Author Comment

by:DylanJones1
ID: 21849458
A few paths, a databse name,  a file filter.   I need to read the config file
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 96

Accepted Solution

by:
Bob Learned earned 500 total points
ID: 21849565
If you get them from the appSettings section, you should be able to use ConfigurationManager.AppSettings.
0
 

Author Comment

by:DylanJones1
ID: 21849674
Here is my code -  this is a windows service that I am debugging via a fom

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <appSettings>
    <add key="DatabaseUpdaterRemotePath" value="Y:\IPB\Dch" />
    <add key="DatabaseUpdaterLocalPath" value="C:\IPXML\Dch" />
    <add key="DatabaseUpdaterFilter" value="*.XML*" />
    <add key="DatabaseUpdaterIncludeSubs" value="true" />
    <add key="DatabaseName" value="Disconnected.MDB"/>
  </appSettings>
</configuration>

onfiguration config = ConfigurationManager.OpenExeConfiguration(System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase);

and this
//for testing my service
Configuration config = ConfigurationManager.OpenExeConfiguration(System.Windows.Forms.Application.ExecutablePath)

Then
RemotePath = config.AppSettings["DatabaseUpdaterRemotePath"].ToString();

this blows up and the appsettings are empty - it is automatically pulling from machine.config


0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 21849817
Did you try this?

string remotePath = ConfigurationManager.AppSettings["DatabaseUpdaterRemotePath"];
0
 

Author Comment

by:DylanJones1
ID: 21850074
Yes That does not work either
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now