Auto save datatable as xml periodically
I have a datatable in my windows application which will be updated by the user. I want my datatable to be saved as backup file as an xml file for every 30mins. How can this be done. I'm using VS2008.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Amit ChoudharyRank #145 · 15.8K reputationPosted Feb 25, 2010, 2:39 AM EST
I suggest you to do it from the Database end. not from your window application end cause if you write program for it then it'll take backup only when your application is running.
But if you want as long as the machine is powered on your data gets Backing up then you can create job and schedules in case of SqlServer.
Few lines of Some T-Sql code will do it easily.
lakchana6 reputationPosted Feb 25, 2010, 7:10 PM EST
Amit ChoudharyRank #145 · 15.8K reputationPosted Feb 25, 2010, 8:12 PM EST
then start a thread as user starts the application and you can run it after a break of 1 min or what ever you want..
and in that thread just export your dataTable to XML using DTable.WriteXml() method.
lakchana6 reputationPosted Mar 2, 2010, 9:17 PM EST
Sam HobbsRank #107 · 20.5K reputationPosted Mar 3, 2010, 8:16 AM EST
I was a database programmer back in the days before Microsoft existed. I am familiar with the database system that large businesses used back then. At that time, the biggest database system that IBM had would write all transactions to a log file, so there was a record of all data. The log files got written to tapes, so if the main system crashed, they would still have the data. I don't know how SQL Server server does something similar but I assume that SQL Server does have a way to retrieve transactions.