-1

我想将数据从 eclips 保存到 sql server 有什么解决方案吗?是否有可能使用 web 服务或 json.. 我已经创建了一个 asp.net 网站并为方法创建了 web 服务......并通过 json 将数据导入到 eclips 中......那么现在如何从 elips 中导入数据?

4

3 回答 3

0

我使用belove代码从android中的asp.net SOAP webservice获取数据试试这个

 public static String SOAP_NAMESPACE = "http://myweb.com/";
public static String SOAP_METHOD_GetQuestionAnswer = "GetQuestionAnswer";

// GetQuestionAnswer Method
public static String GetQuestionAnswer(String GameIDValue, String QuestionIDValue) {
    String responce = null; 

    SoapObject request = new SoapObject(SOAP_NAMESPACE, SOAP_METHOD_GetQuestionAnswer);

    PropertyInfo GameID = new PropertyInfo();
    PropertyInfo QuestionID = new PropertyInfo();

    GameID.setName("gameid");
    GameID.setValue(GameIDValue);

    QuestionID.setName("queid");
    QuestionID.setValue(QuestionIDValue);

    request.addProperty(GameID);
    request.addProperty(QuestionID);

    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
    envelope.dotNet = true;
    envelope.setOutputSoapObject(request);
    HttpTransportSE aht = new HttpTransportSE(SOAP_URL);
    try {
        aht.call(SOAP_ACTION_GetQuestionAnswer, envelope);
        SoapPrimitive LoginResult;
        LoginResult = (SoapPrimitive)envelope.getResponse();
        System.out.println("=================GetQuestion Results: "+LoginResult);
        System.out.println(LoginResult.toString());
        responce = LoginResult.toString();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (XmlPullParserException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    return responce;
}
于 2012-11-30T04:45:20.223 回答
0

在 android 中,您可以创建一个JSON objectPOST输入到asp web service您的remote sql database.

JSONObject obj = new JSONObject();
obj.put("val1",val1);
obj.put("val2",val2);
obj.put("val3",val3);
于 2012-11-30T05:05:51.503 回答
0

@shivanipatel

首先从服务器端你想拥有或创建任何网络服务来接收你来自android的请求并响应那个请求.. ///

之后你想使用
USE NameValuePair 来发布数据。

List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>;
nameValuePairs.add(new BasicNameValuePair("name", Name));
nameValuePairs.add(new BasicNameValuePair("number", Number));

httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));

HttpResponse response = httpclient.execute(httppost);

它会帮助你,亲爱的

——贾廷·帕特尔

于 2012-11-30T06:08:02.893 回答