Convert mdb to xml
-
Dear All, I am looking to convert .mdb access file into xml file using c#. I have googled,but i didnt find any topic related. I am sure about java which does this conversion, but i dont know about c#. such features is available in c# or not?
Member 6059028 wrote:
such features is available in c# or not?
you mean as an inbuilt command export_mdb_to_xml() ?? er, no you'd have to write code that "- either reads a single table or loops through the tables in an mdb, read each row in the (current) table, export each field in row as xml 'g'
-
Member 6059028 wrote:
such features is available in c# or not?
you mean as an inbuilt command export_mdb_to_xml() ?? er, no you'd have to write code that "- either reads a single table or loops through the tables in an mdb, read each row in the (current) table, export each field in row as xml 'g'
-
conversion in a table level is simply done using DataTable methods. but i am looking to fully convert .mdb file into .xml file, including all object in .mdb file.
Use SSIS(Sql Server Integration Services) this service has powerfull abilities for transfering full database or database objects to another database server. You must install sql server 2005 or 2008 and then use this service.
Human knowledge belongs to the world http://www.rad.pasfu.com/index.php
-
Member 6059028 wrote:
such features is available in c# or not?
you mean as an inbuilt command export_mdb_to_xml() ?? er, no you'd have to write code that "- either reads a single table or loops through the tables in an mdb, read each row in the (current) table, export each field in row as xml 'g'
Hey, If you would like to use a dataset and if you are not trying to write the XML document in any specific format, try this. constr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\db.mdb;"; OleDbConnection conn = new OleDbConnection(constr); conn.Open(); DataSet ds=new DataSet(); OleDbDataAdapter da = new OleDbDataAdapter(); OleDbCommand dcmd=new OleDbCommand("select * from table",conn); da.SelectCommand = dcmd; da.Fill(ds); XmlDocument xld = new XmlDocument(); ds.WriteXml("xmlpath");
Jack Sparrow -------------------------------------- Defeat is not the worst of failures. Not to have tried is the true failure.
-
conversion in a table level is simply done using DataTable methods. but i am looking to fully convert .mdb file into .xml file, including all object in .mdb file.
If I remember correctly (not used Access for about 5 years) you can get this information from the MSysAccessObjects table - you may need to look at other MSys* tables as well. You can see what there is by going to Tools|Options and turning on 'Show System Objects' in Access. Of course you'ld have to iterate through these and through whatever table/queries/Reports/Modules you're interested in. (Do you really want to convert VBA code in Modules?)
Regards David R