dimanche 1 mars 2015

JSON Data In Database Work

Can anyone please guide me out how to work on JSON data insert,update & delete work. I have not that much of idea how to work on .


I have done only insert data when i am getting data from server,but how to update data by checking database & server,if data is present or not. Along with how to delete that particular data if the data is not in server.



for (int i = 0; i < jArray.length(); i++) {
JSONObject c = jArray.getJSONObject(i);
// Saajan databse

$id = c.getString("$id");
ID = c.getString("ID");
Name = c.getString("ContactUserName");
Service = c.getString("Service");
CreatedOn = c.getString("CreatedOn");

SimpleDateFormat inputFormat = new SimpleDateFormat(
"yyyy-MM-dd'T'HH:mm:ss");
SimpleDateFormat outputFormat = new SimpleDateFormat(
"dd MMM yyyy hh:mm a");
String sourceDateStr = outputFormat
.format(inputFormat.parse(CreatedOn));

Date sourceDate = outputFormat.parse(sourceDateStr);

Country = c.getString("Country");
CompanyName = c.getString("CompanyName");
AssignedTo = c.getString("AssignedTo");
ProfilePicUrl = c.getString("ProfilePicUrl");

sfadb.insertList($id, ID, Service, Name, CreatedOn,
CompanyName, Country, AssignedTo,
ProfilePicUrl);

timeSegments = CreatedOn.split("T");

String[] s1 = timeZoneOffset.split(":");

sourceTimeZoneOffset = "GMT" + s1[0] + s1[1];
TimeZone destTimeZone = cc.getTimeZone();

Aucun commentaire:

Enregistrer un commentaire