Solved

can i export the structure of a mdb database to xml so i can post it, rather than email the database

Posted on 2004-04-06
2
274 Views
Last Modified: 2008-03-17
good day, in my time at ee,i have had to email databases when experts helped me,
is there a way rather i can somehow export the structure of the mdb database to xml, so that when i post again
i can post the code, and the user can somehow from the xml code create a database
e.g. database
3 tables: (and their fields)

-----------------------------
Car (tablename)
|
-carid(autonumber)
-car(text)
-----------------------------
Customer(tablename)
|
-customerid(autonumber)
-customer(text)
-----------------------------
Sale(tablename)
|
-saleid(autonumber)
-carid(number)
-customerid(number)
-----------------------------
0
Comment
Question by:jxharding
2 Comments
 
LVL 28

Accepted Solution

by:
mmarinov earned 250 total points
ID: 10763694
you can use this scenario

1. get data from the mdb ( using dataadapter and dataset )
2. then you can get the structure of the dataset with the ReadXmlSchema
3. to write the schema to a file you can use this:
c#:
private void WriteSchemaWithXmlTextWriter(DataSet thisDataSet){
   // Set the file path and name. Modify this for your purposes.
   string filename="mySchema.xml";
   // Create a FileStream object with the file path and name.
   System.IO.FileStream myFileStream = new System.IO.FileStream
      (filename,System.IO.FileMode.Create);
   // Create a new XmlTextWriter object with the FileStream.
   System.Xml.XmlTextWriter MyXmlTextWriter =
      new System.Xml.XmlTextWriter(myFileStream, System.Text.Encoding.Unicode);
   // Write the schema into the DataSet and close the reader.
   thisDataSet.WriteXmlSchema(MyXmlTextWriter );
   MyXmlTextWriter.Close();
}

vb.net
Private Sub WriteSchemaWithXmlTextWriter(thisDataSet As DataSet)
    ' Set the file path and name. Modify this for your purposes.
    Dim filename As String = "mySchema.xml"
    ' Create a FileStream object with the file path and name.
    Dim myFileStream As New System.IO.FileStream _
       (filename, System.IO.FileMode.Create)
    ' Create a new XmlTextWriter object with the FileStream.
    Dim MyXmlTextWriter As New System.Xml.XmlTextWriter _
       (myFileStream, System.Text.Encoding.Unicode)
    ' Write the schema into the DataSet and close the reader.
    thisDataSet.WriteXmlSchema(MyXmlTextWriter)
    MyXmlTextWriter.Close()
End Sub


HTH
B..M
0
 
LVL 1

Assisted Solution

by:theonlyfreaky
theonlyfreaky earned 250 total points
ID: 10763711
this program does the job for me

download: http://www.pablovandermeer.nl/getfile.php?id=21
explanation: http://www.pablovandermeer.nl/mdb_2_xml.html

(it's free for personal use)
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

758 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

18 Experts available now in Live!

Get 1:1 Help Now