File: App_Code\Default.vb
Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Data
Imports System.Data.SqlClient
_
_
Public Class Default
Inherits System.Web.Services.WebService
_
Public Function GetDefault() As DataSet
Dim conn As SqlConnection
Dim myDataAdapter As SqlDataAdapter
Dim myDataSet As DataSet
Dim cmdString As String = "Select * From Default"
conn = New SqlConnection("Server=localhost;uid=sa;pwd=;database=Northwind")
myDataAdapter = New SqlDataAdapter(cmdString, conn)
myDataSet = New DataSet()
myDataAdapter.Fill(myDataSet, "Default")
Return myDataSet
End Function
End Class
Changes to the web.config file after making a reference to the Web service
value="http://www.tempuri.com/MyWebService/Default.asmx"/>
Consuming the Default Web service in an ASP.NET page
<%@ Page Language="C#" %>
Web Service Consumer Example