?
Solved

Programtically Importing  XML into Access Database Tables

Posted on 2008-06-23
8
Medium Priority
?
2,214 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 

Author Comment

by:DylanJones1
ID: 21849458
A few paths, a databse name,  a file filter.   I need to read the config file
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 1500 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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Suggested Courses

765 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