云题海 - 专业文章范例文档资料分享平台

当前位置:首页 > NET WebService的创建部署运用

NET WebService的创建部署运用

  • 62 次阅读
  • 3 次下载
  • 2025/12/2 20:45:34

//用户查询得到的将是myDataSet. DataSet myDataSet = new DataSet(); try {

SqlDataAdapter myAdapter = new SqlDataAdapter(); if (mvpguid != \ {

//按照用户输入的mvpguid进行查询.

myAdapter.SelectCommand = new SqlCommand(\MVPGUID='\

SqlCommandBuilder myCB = new SqlCommandBuilder(myAdapter); myAdapter.Fill(myDataSet, \ //建立表间关系.

SqlDataAdapter myAdapter1 = new SqlDataAdapter(\

OtherCompetencies.OtherCompetencies_Id,OtherCompetencies.MVP_Id from MVP,OtherCompetencies where MVP.MVP_Id=OtherCompetencies.MVP_Id and MVP.MVPGUID='\

SqlCommandBuilder myCB1 = new SqlCommandBuilder(myAdapter1); myAdapter1.Fill(myDataSet, \ SqlDataAdapter myAdapter2 = new SqlDataAdapter(\

OtherCompetency.OtherCompetencies_Id,OtherCompetency.OtherCompetency_Text from MVP,OtherCompetencies,OtherCompetency where MVP.MVP_Id=OtherCompetencies.MVP_Id and

OtherCompetencies.OtherCompetencies_Id=OtherCompetency.OtherCompetencies_Id and MVP.MVPGUID='\

SqlCommandBuilder myCB2 = new SqlCommandBuilder(myAdapter2); myAdapter2.Fill(myDataSet, \

SqlDataAdapter myAdapter3 = new SqlDataAdapter(\

Publications.Publications_Id,Publications.MVP_Id from Publications,MVP where MVP.MVP_Id=Publications.MVP_Id and MVP.MVPGUID='\ SqlCommandBuilder myCB3 = new SqlCommandBuilder(myAdapter3); myAdapter3.Fill(myDataSet, \

SqlDataAdapter myAdapter4 = new SqlDataAdapter(\

Publication.Publications_Id,Publication.Id,Publication.Title,Publication.Publisher,Publication.DatePublished,Publication.Abstract,Publication.UrlLink from

MVP,Publications,Publication where MVP.MVP_Id=Publications.MVP_Id and Publications.Publications_Id=Publication.Publications_Id and MVP.MVPGUID='\mvpguid + \

SqlCommandBuilder myCB4 = new SqlCommandBuilder(myAdapter4); myAdapter4.Fill(myDataSet, \ //Create DataRelation, and add it to the DataSet.

DataRelation dr = new DataRelation(\myDataSet.Tables[\

myDataSet.Tables[\

DataRelation dr1 = new DataRelation(\myDataSet.Tables[\ [\

myDataSet.Tables[\ DataRelation dr2 = new DataRelation(\myDataSet.Tables[\ [\

DataRelation dr3 = new DataRelation(\myDataSet.Tables[\

myDataSet.Tables[\

//获取或设置一个指示DataRelation对象是否嵌套的值. dr.Nested = true; dr1.Nested = true; dr2.Nested = true; dr3.Nested = true;

//创建关系到集合中

myDataSet.Relations.Add(dr); myDataSet.Relations.Add(dr1); myDataSet.Relations.Add(dr2); myDataSet.Relations.Add(dr3); } }

catch (SqlException exception) {

return DataError(exception); }

return myDataSet; }

//====================错误信息======================= public DataSet DataError(Exception ex) {

DataSet errDS = new DataSet(\

DataTable errTable = errDS.Tables.Add(\ errTable.Columns.Add(\

errTable.Rows.Add(new Object[] { ex.Message });

return errDS; }

代码有点多,呵呵,然后你在客户端只要引用它的接口就可以了,这样会更好理解一点,代码如下:

//====================客户端查询函数===================== protected void btnSearch_Click1(object sender, EventArgs e) {

string c_mvpGuid = \ try {

c_mvpGuid = this.txtByMVPGUID.Text.ToString(); //getDataSet对象获得查询返回的ds.

DataSet getDataSet = myService.searchData(c_mvpGuid);

///查询默认显示为MVP表.测试的时候在index.aspx页面上显示. this.dgResult.DataSource = getDataSet.Tables[\ this.dgResult.DataBind(); }

catch (Exception ex) {

throw ex; } }

要是有什么不懂的地方,你可以留言,我会给你答复。^_^

呵呵,忘了一件事,如果你用自己的xml文件,自己的数据库,那就没事了,不是的话看看:

搜索更多关于: NET WebService的创建部署运用 的文档
  • 收藏
  • 违规举报
  • 版权认领
下载文档10.00 元 加入VIP免费下载
推荐下载
本文作者:...

共分享92篇相关文档

文档简介:

//用户查询得到的将是myDataSet. DataSet myDataSet = new DataSet(); try { SqlDataAdapter myAdapter = new SqlDataAdapter(); if (mvpguid != \ { //按照用户输入的mvpguid进行查询. myAdapter.SelectCommand = new SqlCommand(\MVPGUID='\ SqlCommandBuilder myCB = new SqlCommand

× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:10 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219
Copyright © 云题海 All Rights Reserved. 苏ICP备16052595号-3 网站地图 客服QQ:370150219 邮箱:370150219@qq.com