Click here to Skip to main content
15,503,885 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
SQL
I need to synchronize online XML file which given to me from another website with my access database
what I exactly need is to make this sync offline which means that when my website user open the page he will find the last data from xml file

I tried to fix it by deleting all the table data and then using LINQ to read the XML file and insert it to Access database
every time the page load which make delay about 5 min and this is off course not acceptable.
Please Help me with this situation

Posted

1 solution

I would recommend writing a Windows service that will run at scheduled intervals as decided by you and download the latest XML files from the external website to your server and save the data in those XML files to your database.

This will help you save precious user time because you can schedule the service to run at a time you know new XML files would be available (for .e.g the service can run over night to download the latest files and save it to database).

Ofcourse, you can tweak this behavior to make it more flexible for you and easy for your users.

Hope this helps a bit.
 
Share this answer
 
Comments
I.explore.code 15-Oct-12 6:16am    
There is a component in .NET called FileSystemWatcher that monitors a folder for any changes and raises events if any changes are made. Have a look at this article: FileSystemWatcherEx. Just a recommendation, rather than trying to sweat to update just the changes its best if you delete the previous data (if you don't need it) and re-populating your tables with the new XML files. Since it would be running at zero or low load time, it should be alright.

Also make sure that you have network path access to the folder that you want to monitor, otherwise, the FSW component wouldn't work. If you don't have network path access to the drive/folder, you would have to download the files to your server, read the file data in dataset or something, read the table data in another dataset, compare and then save the changes. This is not the full solution but an idea which you can certainly improvise upon.
Kirolos Costa 15-Oct-12 9:27am    
The problem is that FileSystemWatcher not working with online xml file which is given to me as a link with authentication
I.explore.code 15-Oct-12 9:47am    
yeah I thought so, in that case you will have to download the files to your server/machine first and then update your database. Assuming that these XML files always contain updated data, you can download them anytime preferably at night when you know the data is not going to be used. And once the files are all downloaded then you can kick-off the database update. Does this make sense?
Kirolos Costa 16-Oct-12 4:30am    
Please I need a sample code of how to sync some data from XML file with an access database every time XML is changed in the background with knowing that this XML file is given to me from another website with authentication .I need a fast and easy example please
I.explore.code 16-Oct-12 4:38am    
sorry mate, we don't do customised solutions for anyone here. YOur best best would be to try vworker.com, you can hire coders online that can give you " a fast and easy" working solution.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900