使用android应用程序在Sql Server中插入数据 [英] Insert data in Sql Server using android application

查看:75
本文介绍了使用android应用程序在Sql Server中插入数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我成功连接android到sql server并获取数据,但我也想在服务器数据库中插入数据,所以任何人给我代码或教程.......

i successfully connect android to sql server and get data but i want also insert data in server database so any one give me code or tutorial.......

推荐答案

Hello Kishan,



我假设您必须使用SQL Server JDBC驱动程序连接到SQL Server。这不是从移动设备与数据库通信的好方法。以这种方式连接实际上将通过互联网公开您的数据库,这可能不是您真正想要的。建议您创建简单的Web服务(SOAP或REST)并从设备访问这些服务。对于REST + JSON服务,您可以使用Android SDK中提供的 DefaultHttpClient 类。您甚至可以搜索 [ ^ ]这个非常站点找到一些描述这种情况的有趣文章。



假设您仍然想继续使用JDBC方法,那么问题出在哪里。你总是可以使用Statement / PreparedStatement类来激活你的INSERT / UPDATE SQL来完成工作。



问候,
Hello Kishan,

I Suppose you must have used SQL Server JDBC Driver to connect to the SQL Server. This is not really a good way to communicate with the database from a mobile device. Connecting in this manner will actually expose your database over internet, which you may not really want. Suggest you to create simple web services (SOAP Or REST) and access those from the device. For REST+JSON services you can use DefaultHttpClient class available in Android SDK. You can even search[^] this very site to find some interesting articles describing this scenario.

Assuming that you still want to continue with the JDBC approach then where is the problem. You can always use Statement/PreparedStatement classes to fire your INSERT/UPDATE SQL's to get the job done.

Regards,


http://stackoverflow.com/questions/15897774/i-am-trying-to-create-an-app-in-android-to-insert-data-into-sql-server-through-a [ ^ ]


这篇关于使用android应用程序在Sql Server中插入数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆