1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

how to export from mdb to xml

Discussion in 'C' started by tieger, Oct 3, 2010.

  1. tieger

    tieger New Member

    Joined:
    Oct 3, 2010
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    Hello all!

    I'm looking for a way to use the export func in ACCESS from inside a cpp code.
    I need to export a table to XML.

    For now, all that I came up with is an SQL command which export the table to excel:
    Code:
    CDatabase db;
    CString SQL;
       SQL = "SELECT * FOR XML PATH(Service), ROOT(Services) queryout c:\\customers.xml FROM Tmp_Wire_Out";
       SQL = "SELECT * INTO "
             "[Excel 8.0;HDR=Yes;DATABASE=c:\\customers.xls].[Sheet1] "
             "FROM [Customers]";
       try
       {
          db.OpenEx( "Driver=Microsoft Access Driver (*.mdb);"
                     "DBQ=c:\\kmidwgs.mdb;", CDatabase::noOdbcDialog );
          db.ExecuteSQL( SQL);
       }
    
    I was wondering, maybe anyone here knows how to change this line so it will export to XML?
    Or maybe someone knows how to do it some other way?

    I would really appreciate it.
    Thanks in advance!
     
    Last edited by a moderator: Oct 3, 2010
  2. developer7281

    developer7281 New Member

    Joined:
    May 13, 2010
    Messages:
    3
    Likes Received:
    1
    Trophy Points:
    0
    Location:
    Island
    Any reports generator can do this. For example FastReports. There're a number of such generators.
     
  3. tieger

    tieger New Member

    Joined:
    Oct 3, 2010
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    yes, but I want to do it myself, write it on my own in CPP...
    do you have any idea how to do it?
     
  4. developer7281

    developer7281 New Member

    Joined:
    May 13, 2010
    Messages:
    3
    Likes Received:
    1
    Trophy Points:
    0
    Location:
    Island
    As for FastReports, you can write in Delphi or C#, but you can easily create a dll with needed functionality that'll wrap out native FR's classes and then use this dll from your C++ code.
     
  5. tieger

    tieger New Member

    Joined:
    Oct 3, 2010
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    excuse me for my ignorant, but I really don't know what you are talking about...
    could you explain it a litter more for a beginner like me?

    thanks
     
  6. developer7281

    developer7281 New Member

    Joined:
    May 13, 2010
    Messages:
    3
    Likes Received:
    1
    Trophy Points:
    0
    Location:
    Island
    Okay. Assume, we've already got FR installed, so we have numerous source .pas files written in Delphi. Then we open FR's designer and make a report template and connect it to the mdb database - these steps will take a few minutes at most and you'll not have to know any programming language, because FR's designer is visual. When the template's been made, you go to some Delphi IDE, such as Embarcadero RAD Studio. In this IDE you create a new project and write a few lines of code in Delphi. This code loads the report template and exports it to xml format.
     
    tieger likes this.

Share This Page