Click to See Complete Forum and Search --> : Generate Access Data from XML schema


Galen
September 4th, 2008, 04:54 PM
I'm trying to generate tables inside an Access database with an XML schema file. Then I want to fill those tables with data from XML files that are based on the later XML schema. I've been trying forever just to get the tables created inside the database but with no success. I guess I just don't understand ADO .NET yet. Here is the code I'm working with. After I load the XML schema into the dataset I can see that the data set has all the Tables and Columns I want. How do I put those in the database?

public void WriteToDatabase(String xml)
{
TextReader stringReader = new StringReader(xml);

// Create a validating reader that wraps the XmlNodeReader object.
XmlReader reader = XmlReader.Create(stringReader, m_settings);

m_dataSet.ReadXmlSchema("Summary.xsd")
m_dataSet.ReadXml(reader);
m_dataSet.AcceptChanges();

m_oleDbDataAdapter.Fill(m_dataSet);
m_oleDbDataAdapter.Update(m_dataSet);
}

Galen
September 10th, 2008, 08:26 AM
I finally found an answer in some other forum. The answer is that there is no easy way for me to do what I want to do (If I didn't mention it I'm using ADO .NET and an Access DB). In order to create tables in the database I can't work backwards from the DataSet. I'm going to have to create SQL statements based on the information already in the DataSet.

This is a real disappoint since this would greatly simplify my code. Hopefully, they will add this capability sooner or later.

http://www.xtremedotnettalk.com/showthread.php?t=73793