日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
概括VB.NET創(chuàng)建WebService

VB.NET還是比較常用的,于是我研究了一下VB.NET創(chuàng)建WebService,在這里拿出來和大家分享一下,希望對(duì)大家有用。

VB.NET創(chuàng)建WebService.

具體步驟如下:

1. 新建一個(gè)項(xiàng)目,選擇ASP.NET Web服務(wù),命名為:“WebService For 業(yè)務(wù)層”。

2. 添加兩個(gè)Sql DataAdapter,一個(gè)為Customer_da,它指向NorthWind數(shù)據(jù)庫的Customers表,另一個(gè)為Order_da,指向Northwind數(shù)據(jù)庫的Orders表。

3. 然后生成一個(gè)Typed DataSet(選擇“數(shù)據(jù)”菜單的“生成數(shù)據(jù)集”),命名為:Super_ds.

4. 數(shù)據(jù)庫連接已經(jīng)完成,下一步我們將考慮它與表示層之間的通信,這里我們定義兩個(gè)方法。一個(gè)為:Get_DataSet,它返回一個(gè)Super_ds類型的數(shù)據(jù)集,另一個(gè)為:Update_DataSet,它負(fù)責(zé)更新數(shù)據(jù)庫數(shù)據(jù), 方法代碼如下:

 
 
 
  1. Public Function Get_Dataset() As super_ds  
  2. customer_da.Fill(Super_ds1.Customers)  
  3. order_da.Fill(Super_ds1.Orders)  
  4. Return Super_ds1  
  5. End Function  
  6.  
  7. Public Sub Update_Dataset()  
  8. Super_ds1.AcceptChanges()  
  9. End Sub  

你可以運(yùn)行測試一下你的VB.NET建立WebService,它將提供兩個(gè)方法。返回的DataSet是以XML表示的。

業(yè)務(wù)層的完整代碼如下:

 
 
 
  1. Imports System.Web.Services  
  2. Public Class Service1  
  3. Inherits System.Web.Services.WebService  
  4. 'Web Services Designer Generated Code……。  
  5.   Public Function Get_Dataset() As super_ds  
  6. customer_da.Fill(Super_ds1.Customers)  
  7. order_da.Fill(Super_ds1.Orders)  
  8. Return Super_ds1  
  9. End Function 
  10.   Public Sub Update_Dataset()  
  11. Super_ds1.AcceptChanges()  
  12. End Sub 
  13. ' WEB SERVICE EXAMPLE  
  14. ' The HelloWorld() example service returns the string Hello World.  
  15. ' To build, uncomment the following lines then save and build the project.  
  16. ' To test this web service, ensure that the .asmx file is the start page  
  17. ' and press F5.  
  18. '  
  19. '  Public Function HelloWorld() As String  
  20. ' HelloWorld = "Hello World"  
  21. ' End Function  
  22. End Class 

文章名稱:概括VB.NET創(chuàng)建WebService
文章位置:http://www.5511xx.com/article/ccieehg.html