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

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

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

Suggested Solutions

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
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…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

733 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