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
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
277 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

839 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