It depends very much on which database product you are using e.g. you could issue the SQL command to export the database. But assuming you don't have that facility and keeping it simple, you could try something like this ...
DataSet ds = new DataSet(tablename);
SqlDataAdapter da = new SqlDataAdapter("Select * from " + tablename, GetConnection());
da.Fill(ds);
ds.WriteXml(Path.Combine(foldername, tablename) + ".xml", XmlWriteMode.WriteSchema);
This will give you one XML file per table, how you get all the table names again depends on the database you're using.
There's lots of support in C# for this sort of thing - for a more complete solution try reading
SQL Server 2005 Database Backup and Restore using C# and .NET 2.0[
^]
[
]