Programtically Importing XML into Access Database Tables

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?  
DylanJones1Asked:
Who is Participating?
 
Bob LearnedCommented:
If you get them from the appSettings section, you should be able to use ConfigurationManager.AppSettings.
0
 
Bob LearnedCommented:
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
 
DylanJones1Author Commented:
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
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
Bob LearnedCommented:
What are you trying to get from the config file?
0
 
DylanJones1Author Commented:
A few paths, a databse name,  a file filter.   I need to read the config file
0
 
DylanJones1Author Commented:
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
 
Bob LearnedCommented:
Did you try this?

string remotePath = ConfigurationManager.AppSettings["DatabaseUpdaterRemotePath"];
0
 
DylanJones1Author Commented:
Yes That does not work either
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.