I have created one web site and android applcation and I have used backed as SQL Server 2008. I have used web services to display data from server to android application for that i have used JSON and ksoap library and it is working fine. I can display data from server to android. But now i want to store data from android application to SQL Server 2008. So anyone please tell me the step or how i can do that. Please help.
You can connect to SQL Server database through webservice.
Here is the sample code to call the webservice.
String url = "your_webservice_URL";
try
{
HttpPost loginHttpPost = new HttpPost(url);
HttpContext localContext = new BasicHttpContext();
MultipartEntity multipartContent = new MultipartEntity();
multipartContent.addPart("parameter1", new StringBody(value1));
multipartContent.addPart("parameter2", new StringBody(value2));
loginHttpPost.setEntity(multipartContent);
HttpClient objHttpClient = new DefaultHttpClient();
HttpResponse response = objHttpClient.execute(loginHttpPost,localContext);
}
catch (IOException e) {
e.printStackTrace();}
Here is the example source code to Connect Android to SQL sever via WCF using JSON
Example :
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.