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

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


Similar Articles