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.
-
1"android post request" type that on Google.comBudius– Budius2013年01月08日 10:03:52 +00:00Commented Jan 8, 2013 at 10:03
2 Answers 2
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();}
-
ok...but can you tell me how i can write asp.net web service to insert data??shivani patel– shivani patel2013年01月08日 10:09:49 +00:00Commented Jan 8, 2013 at 10:09
-
actually i have created the web service for display data by calling the stored procedure. but i dont know how to insert data from web service.shivani patel– shivani patel2013年01月08日 10:13:43 +00:00Commented Jan 8, 2013 at 10:13
-
stackoverflow.com/questions/13379936/…Talha– Talha2013年01月08日 10:18:07 +00:00Commented Jan 8, 2013 at 10:18
Here is the example source code to Connect Android to SQL sever via WCF using JSON
Example :
Explore related questions
See similar questions with these tags.