社区
Web Services
帖子详情
webservice直接连接数据库
wuwenzhe
2012-11-28 04:14:51
从网上找到的都是网站添加web服务引用之后,连接数据库的工作都是网站完成的,有没有webservice直接连接数据库的例子?
...全文
1358
4
打赏
收藏
webservice直接连接数据库
从网上找到的都是网站添加web服务引用之后,连接数据库的工作都是网站完成的,有没有webservice直接连接数据库的例子?
复制链接
扫一扫
分享
转发到动态
举报
AI
作业
写回复
配置赞助广告
用AI写文章
4 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
AlexChowKey
2012-11-29
打赏
举报
回复
在webservice中用jdbc连接就可以了 http://download.csdn.net/detail/chow__zh/4819692这里有实例代码,连接mysql的 下载解压直接使用
心梦缘-雪雁
2012-11-28
打赏
举报
回复
我写的这个是一个级联的案例 你看下吧
心梦缘-雪雁
2012-11-28
打赏
举报
回复
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Services; using System.Data; using System.Data.SqlClient; namespace ClothMSN { /// <summary> /// ShopService 的摘要说明 /// </summary> [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [System.ComponentModel.ToolboxItem(false)] // 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消对下行的注释。 [System.Web.Script.Services.ScriptService] public class ShopService : System.Web.Services.WebService { [WebMethod] public string HelloWorld() { return "Hello World"; } [WebMethod] public string[] getNames(string prefixText, int count) { SqlConnection conn = new SqlConnection("server=.;database=ClothMSN;integrated security=True"); SqlDataAdapter sda = new SqlDataAdapter("select * from goodInfo where goodName like '%" + prefixText + "%'", conn); DataTable dt = new DataTable(); sda.Fill(dt); string[] names = null; if (dt.Rows.Count > 0) { names = new string[dt.Rows.Count]; for (int i = 0; i < dt.Rows.Count; i++) { names[i] = dt.Rows[i][1].ToString(); } } else { names = new string[] { "未查找到对应的记录" }; } return names; } } }
hard_learner
2012-11-28
打赏
举报
回复
你随便找本稍微正规讲解webservice的应该都有讲解,如果是自己写的webservice的话连接数据库的操作是在webservice中的,你看的可能是编写的网站使用第三方公开的webservice接口,顺便建议,如果你是新接触webservice的话不如学习wcf,呵呵
silverlight-通过-
WebService
-
连接数据库
.doc
silverlight-通过-
WebService
-
连接数据库
.doc
C#通过
webservice
连接Oracle 9i数据库
C#运行的程序电脑不需要安装Oracle客户端,只需要将
webservice
接口部署在已经安装有客户端的机子上,即可实现操作Oracle 9i数据库!
Flex调用
WebService
访问MSSQL数据库
Flex调用
WebService
访问MSSQL数据库
PocketPC通过
WebService
操作服务数据库C#源代码
PocketPC通过
WebService
操作服务数据库C#源代码,包含通过
WebService
读定数据库及
WebService
中使用自定义类的解决方法等。
数据库操作的封装类,可以访问SQL与Ascess,并且可以通过
WebService
远程访问数据库
数据库操作的封装类,可以访问SQL与Ascess,并且可以通过
WebService
远程访问数据库
Web Services
12,166
社区成员
16,325
社区内容
发帖
与我相关
我的任务
Web Services
.NET技术 Web Services
复制链接
扫一扫
分享
社区描述
.NET技术 Web Services
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章