Best means to store data locally when offline

和自甴很熟 提交于 2020-01-13 12:17:07

问题


I am in the midst of writing a small program (more to experiment with vs 2010 than anything else)

Despite being an experiment it has some practical use for our local athletics club.

My thought was to access the DB (currently online) to download the current members and store locally on a laptop (this is a MS sql table, used to power the club's website).

Take the laptop to the event (yes there ARE places that don't have internet coverage), add members to that days race (also a row from a sql table (though no changes would be made to this), record results (new records in 3rd table)

Once home, showered and within internet access again, upload/edit the tables as per the race results/member changes etc.

So I was thinking I'd do something like write xml files locally with the data, including a field to indicate changes etc?

If anyone can point me in a direction I would appreciate it...hell if anyone could tell me if this has a name, I'd appreciate it.


回答1:


Essentially what you need is, in addition to your remote data store, a local data store on your desktop. You could then write your code by hand to sync the data stores when you go offline / online, or you could use the Microsoft Sync framework to handle it for you.

I've personally used the Sync framework on a number of projects and once you get used to the conventions, it's pretty easy to use.




回答2:


If a local storage format is what your after. SQLite is one option. You can copy your tables from the server to your local SQLite db.

You could also save your data to files, but XML is a horrible format for doing this. You'll probably want to use YAML or JSON instead.




回答3:


You may want to take a look at SQL Server Compact -- it provides some decent capabilities with synchronizing back with the mothership SQL server.




回答4:


If you're using MS SQL Server for production, and you only need to work offline on your personal computer, you could install MS SQL Server Express locally. The advantage here over using a different local datastore is that you can reuse your schema, stored procedures, etc. essentially only needing to change the connection string to your application (which you could run locally too through Visual Studio). You would have to write code to manually sync your online and offline db instances, but since it's a small application, it may be reasonable to just copy the entire database from production to local and then from local to production when you get home (assuming you're the only one updating the db, and wouldn't be potentially wiping out any new records entered in production while you were at the event).




回答5:


Google Gears http://gears.google.com/ is intended if your app is a web app (which I didn't quite get what it is from your description)



来源:https://stackoverflow.com/questions/2901238/best-means-to-store-data-locally-when-offline

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!