操作回顧
現在您將很有希望獲得關於這一點的相關感覺雖然可以使控件不是那麼突出但基本的要點都在這兒公認的情況是這稍微有點重復但應該進行簡化以便於記住再次聲明Web服務返回一個數據集這一次WebMethod有更多的事情需要做首先創建返回數據集的函數
Public Function ViewLeague() As DataSet
該函數中的第一個任務是連接到數據庫使用預先定義的WroxUnited連接字符串來做到這一點
Dim conn As New SqlConnection(ConfigurationManagerConnectionStrings(WroxUnited)ConnectionString)
然後創建返回MiniLeague表所需的SQL創建兩個SqlDataAdapter每個SQL字符串帶有一個SqlDataAdapter需要兩個SqlDataAdapter因為一個是完整的表而另一個是相同聯盟表的迷你視圖adapter包含該表的新縮短視圖其中只有個隊伍而adapter包含完整的表
sqlstring = SELECT [OpponentID] [Name] [TotalGoalsFor] [TotalGoalsAgainst] [TotalGoalsFor][TotalGoalsAgainst] AS [GoalDifference] [Points] FROM [Opponents] Order By [Points] DESC [GoalDifference] DESC [TotalGoalsFor] DESC
Dim adapter As New SqlDataAdapter(sqlstring conn)
Dim adapter As New SqlDataAdapter(sqlstring conn)
[] [] [] [] [] []
From:http://tw.wingwit.com/Article/program/net/201311/14737.html