Hi,
Am developing a registration forms application, it is deveoped in MVVM pattern.
Requirement is when user clicks save button of that form.. need to check the device have internet connect or not. If yes the values need to be saved in main SQL database, or it should save in SQLite, once the device get internet connection values from SQLite are moved to main SQL database.
This is common requirement in mobile apps development am very new to mobile development, am C# developer for Win and Web forms.
Kindly share some sample codes or provide some resources.
Mirror your server based SQL schema into a SQLite database on the device, adding one new field on the SQLite tables called uploaded as a bool field, set it to 0, save locally when not connected, once connected find all the local records that have uploaded=0 and upload them, you decide if you want to delete those records from the local copy once the server has been updated.
What I did on one project was the above but also had the primary key of the server record brought back down to the client app and saved into the record as well.
If you use SQLite ORM this pretty straight forward, create classes for each of the tables, use
db.createtable();
creates the table based on the tblcustomers class.
tblcustomers customer = new tblcustomers();
customer.firstname = "your first name";
customer.lastname = "your last name";
db.insert(customer);
There is plenty of examples on the web for SQLite, the key thing is aligning the field types correctly, if your using float, double, singles, string, bool, int are straight forward.
atb
alex
Answers
I would like to know this aswell!!
Mirror your server based SQL schema into a SQLite database on the device, adding one new field on the SQLite tables called uploaded as a bool field, set it to 0, save locally when not connected, once connected find all the local records that have uploaded=0 and upload them, you decide if you want to delete those records from the local copy once the server has been updated.
What I did on one project was the above but also had the primary key of the server record brought back down to the client app and saved into the record as well.
If you use SQLite ORM this pretty straight forward, create classes for each of the tables, use
db.createtable();
creates the table based on the tblcustomers class.
tblcustomers customer = new tblcustomers();
customer.firstname = "your first name";
customer.lastname = "your last name";
db.insert(customer);
There is plenty of examples on the web for SQLite, the key thing is aligning the field types correctly, if your using float, double, singles, string, bool, int are straight forward.
atb
alex