In such DBMS as Oracle or PostgreSQL there are functions for generating XML Data from the database: http://docs.oracle.com/cd/B19306_01/appdev.102/b14259/xdb13gen.htm or http://www.postgresql.org/docs/current/static/functions-xml.html#AEN15086
My question are there something similar in SQLite database? May be there are some additional tools, libraries or even standard tools for this purpose?
Here we are going to create an XML file from Database. Make an SQL connection to the Database and execute the sql and store the data in a Datset. Call Dataset's WriteXml() method and pass the file name as argument. You have to pass necessary database connection information to connection string.
With SQL Server Management Studio, you can save your SQL database as CSV and then you can convert the database files to XML, PDF or other formats as you like.
Long answer: It is said you can't use SQLite in production because it doesn't support concurrency (no more than one user can be writing to the database at the same time) and it can't scale.
If you are using C#.NET there can be two ways for it.
You can get the data into datasets and use the .WriteXml() method to write into the xml file.
var sqc = new SqlConnection(ConfigurationManager.ConnectionStrings["AddsConnectionString"].ConnectionString);
sqc.Open();
var q = "select * from adv";
var sqd = new SqlDataAdapter(q, sqc);
var ds = new DataSet();
sqd.Fill(ds,"adv");
ds.WriteXml("d:/data.xml");
Do not forget to include System.Xml
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With