ARTICLE

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

Posted by Vikram Joshi Articles | Visual Basic .NET November 09, 2012
This example illustrated how to create a Webservice and how to consume it.
Reader Level:
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

Login to add your contents and source code to this article
post comment
     
COMMENT USING
PREMIUM SPONSORS
Over-C is a holistic consortium of communications and technology specialists. We build, deploy and market both business as well as consumer products and solutions.
Get Career Advice from Experts
SPONSORED BY
  • PDF reports have never been easier to create. With our included WYSIWYG Designer, you can layout your reports, set up your data source and let DynamicPDF ReportWriter do the rest.