简体   繁体   English

如何创建Web服务以将android与Microsoft SQL Server数据库连接?

[英]How to create webservice to connect android with microsoft sql server database?

I want to create webservice which will do logical operations such read,write,insert,update records from SQL server database and returns the response in json object. 我想创建Web服务,它将执行逻辑操作,例如从SQL Server数据库读取,写入,插入,更新记录,并在json对象中返回响应。

After reading that responses I want update the values in android local SQLite database...... 阅读该响应后,我想更新android本地SQLite数据库中的值...

Google "REST web service Java." Google“ REST Web服务Java”。 You should get by with that. 你应该顺其自然。

If you want to build it yourself, you can write an HTTP Post Request method in a class. 如果要自己构建它,则可以在一个类中编写HTTP Post Request方法。 As the request, a post item "request" can carry the value. 作为请求,发布项目“ request”可以带有值。 This can be "read", "write", "insert", "update", "collect all records", "delete them all", .. etc. With other parameter, you can send other details. 可以是“读取”,“写入”,“插入”,“更新”,“收集所有记录”,“全部删除”,..等等。使用其他参数,您可以发送其他详细信息。

You haven't specified the language you will use for webservice. 您尚未指定将用于Web服务的语言。 It probably will be ASP.NET, since you are using SQL Server. 由于您正在使用SQL Server,因此可能是ASP.NET。 So on "onload" request, you can take the details from "Request" attribute and according to value of "request", you route the webservice to a method. 因此,在“ onload”请求上,您可以从“ Request”属性中获取详细信息,并根据“ request”的值,将Web服务路由到方法。 And that method connects to SQL Server, completes the request and returns back to Android. 然后该方法连接到SQL Server,完成请求,然后返回到Android。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM