Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   how to export from mdb to xml (http://www.go4expert.com/forums/export-mdb-xml-t23469/)

tieger 3Oct2010 13:07

how to export from mdb to xml
 
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!

developer7281 3Oct2010 15:44

Re: how to export from mdb to xml
 
Any reports generator can do this. For example FastReports. There're a number of such generators.

tieger 3Oct2010 15:51

Re: how to export from mdb to xml
 
yes, but I want to do it myself, write it on my own in CPP...
do you have any idea how to do it?

developer7281 3Oct2010 16:12

Re: how to export from mdb to xml
 
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.

tieger 3Oct2010 16:18

Re: how to export from mdb to xml
 
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

developer7281 3Oct2010 16:48

Re: how to export from mdb to xml
 
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.


All times are GMT +5.5. The time now is 05:47.