Reader Level:
ARTICLE

A Demo for creating and consuming the Webservice in VB.NET

On November 09, 2012 Articles | Visual Basic .NET
This example illustrated how to create a Webservice and how to consume it.
  • 0
  • 0
  • 5990
Download Files:
 

Hello friends in this example I have illustrated how to create a Webservice and how to consume it. I have included the readme.txt file which explains the purpose of the Webservice and its usage. Also in the ZIP file i have include the solution files for the Webservice and the Application.
 

The attached project zip file has two files. Readme.txt and WebService.zip. Readme explains how to use the code.

Sample code for the Webservice CSC:

Public Function GetCSC(Optional ByVal Countryname As String = "", Optional ByVal Statename As String = "") As

    DataSet

    Dim ds As New DataSet()

    conStr = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=WorldCSC;Data

    Source=WEBMASTER;"

    adconn = New ADO.ADOConnection(constr)

    adconn.Open()

    If countryname = "" Then

        sqlStr = "Select * from Countrymaster"

    Else

        If statename = "" Then

            sqlStr = "select * from Statemaster where countryId = (select countryID from countrymaster where 

            countryname = '" & Trim(countryname) & "')"

        Else

            sqlStr = "select * from citymaster where stateId = (select stateid from statemaster where statename

            = '" & Trim(statename) & "')"

        End If

    End If

 

    addataset = New ADO.ADODataSetCommand(sqlstr, adconn)

    If Countryname = "" Then

        addataset.FillDataSet(ds, "Countrymaster")

    Else

        If statename = "" Then

            addataset.FillDataSet(ds, "StateMaster")

        Else

            addataset.FillDataSet(ds, "CityMaster")

        End If

    End If

    GetCSC = ds 

End Function

Vikram Joshi

Vikram has just finished his Masters in Computer Application(MCA), working currently as a developer for iSpan Technologies, Mumbai, India.Like others, he has found VB.NET a boon in disguise but hope...

  • 489rank
  • 60K readers
COMMENT USING

Trending up