how to export from mdb to xml

tieger's Avatar, Join Date: Oct 2010
Newbie Member
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 shabbir; 3Oct2010 at 13:10.. Reason: Code blocks
0
developer7281's Avatar, Join Date: May 2010
Newbie Member
Any reports generator can do this. For example FastReports. There're a number of such generators.
0
tieger's Avatar, Join Date: Oct 2010
Newbie Member
yes, but I want to do it myself, write it on my own in CPP...
do you have any idea how to do it?
0
developer7281's Avatar, Join Date: May 2010
Newbie Member
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.
0
tieger's Avatar, Join Date: Oct 2010
Newbie Member
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
0
developer7281's Avatar, Join Date: May 2010
Newbie Member
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 like this