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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

776 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