有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java使用json和restful将数组数据从本地sqlite数据库插入SQL Server

如何使用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(){


    }
}

共 (1) 个答案

  1. # 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