NET WebServiceµÄ´´½¨²¿ÊðÔËÓÃ

2026/1/26 21:13:26

//Óû§²éѯµÃµ½µÄ½«ÊÇ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µÄ´´½¨²¿ÊðÔËÓÃ.doc ½«±¾ÎĵÄWordÎĵµÏÂÔØµ½µçÄÔ
ËÑË÷¸ü¶à¹ØÓÚ£º NET WebServiceµÄ´´½¨²¿ÊðÔËÓà µÄÎĵµ
Ïà¹ØÍÆ¼ö
Ïà¹ØÔĶÁ
¡Á ÓοͿì½ÝÏÂÔØÍ¨µÀ£¨ÏÂÔØºó¿ÉÒÔ×ÔÓɸ´ÖƺÍÅŰ棩

ÏÂÔØ±¾ÎĵµÐèÒªÖ§¸¶ 10 Ôª

Ö§¸¶·½Ê½£º

¿ªÍ¨VIP°üÔ»áÔ± ÌØ¼Û£º29Ôª/ÔÂ

×¢£ºÏÂÔØÎĵµÓпÉÄÜ¡°Ö»ÓÐĿ¼»òÕßÄÚÈݲ»È«¡±µÈÇé¿ö£¬ÇëÏÂÔØÖ®Ç°×¢Òâ±æ±ð£¬Èç¹ûÄúÒѸ¶·ÑÇÒÎÞ·¨ÏÂÔØ»òÄÚÈÝÓÐÎÊÌ⣬ÇëÁªÏµÎÒÃÇЭÖúÄã´¦Àí¡£
΢ÐÅ£ºxuecool-com QQ£º370150219