【问题标题】:Insert array data into SQL Server from local sqlite database using json and restful [closed]使用json和restful将数组数据从本地sqlite数据库插入SQL Server [关闭]
【发布时间】:2016-12-30 04:15:51
【问题描述】:

如何使用json和restful将数组数据从本地sqlite数据库插入SQL Server?请任何人告诉我这个想法......

public static class MyTask extends AsyncTask<String,String,String> {

    @Override
    protected void onPreExecute() {
        super.onPreExecute();
    }

    @Override
    protected String doInBackground(String... params) {

        return null;
    }

    @Override
    protected void onPostExecute(String s) {
        super.onPostExecute(s);
    }

    public void sendDataToServer(){


    }
}

【问题讨论】:

  • 欢迎来到 SO!你试过什么了?为了帮助我们帮助您,请添加Minimal, Complete, and Verifiable example
  • 如何通过json将android连接到服务器?
  • 您可以编写一个 REST/SOAP api 从您的服务器获取/发布数据到应用程序,反之亦然。
  • 我有那个 API
  • 那么问题是什么?

标签: java android sql-server json


【解决方案1】:

您可以尝试将JSONObject 或模型类object 存储到本地数据库中。

// This is for get data from database.
Gson gson = new Gson();
String strDate = cursor.getString(cursor.getColumnIndex("column name"));
Customer customer = gson.fromJson(strDate , Customer.class);

customer你会得到对象,然后你可以把这个对象发送到sql server。

【讨论】:

  • 进入服务器????
  • 等我更新我的答案。
  • sry...,如何发送?
  • 为此你需要 API,你有 API 吗?
  • 我是 android 新手... API 是什么意思?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-06-11
  • 1970-01-01
  • 1970-01-01
  • 2019-11-22
  • 2012-01-31
相关资源
最近更新 更多