Share via


FindBusiness Constructor (String)

Note: The Microsoft UDDI SDK is not supported by or included in Microsoft Windows versions after Microsoft Windows Server 7. The Microsoft UDDI V3 SDK is included with Microsoft BizTalk Server. For more information about the Microsoft UDDI V3 SDK, see Microsoft BizTalk Server documentation
Initializes an instance of the FindBusiness class that has the requested business name.

Namespace: Microsoft.Uddi
Assembly: microsoft.uddi (in microsoft.uddi.dll)

Usage

Visual Basic
  Dim name As String
Dim instance As New FindBusiness(name)

Syntax

'Declaration
PublicSubNew ( _
    nameAsString _
)
publicFindBusiness (
    stringname
)
public:
FindBusiness (
    String^ name
)
publicFindBusiness (
    Stringname
)
publicfunctionFindBusiness (
    name : String
)

Parameters

  • name
    The requested business name.

Example

The following example shows you how to use the C# programming language by using this class to find a business.

public void FindBusinessSample(Microsoft.Uddi.UddiConnection myConn,
                               string businessName)
{
    try
    {
        Microsoft.Uddi.FindBusiness findBiz = new FindBusiness(businessName);
        BusinessList bizList = findBiz.Send(myConn);

        // Display the results of the search. 
        int bizCount = bizList.BusinessInfos.Count;

        switch(bizCount)
        {
            case(0):
            {
                Console.WriteLine("No results from the search.");
                return;
            }

            case(1):
            {
                Console.WriteLine(String.Concat("There is one business called ", 
                                                 businessName));
                break;
            }    

            default:
            {
                Console.WriteLine(String.Concat("There are ",
                                                 bizCount, 
                                                 " businesses called ", 
                                                 businessName,
                                                 "."));
                break;
            }
        }

        // Show each business name.
        foreach(BusinessInfo bizInfo in bizList.BusinessInfos)
        {
            foreach(Name bizName in bizInfo.Names)
            {
                Console.WriteLine(bizName.Text);
            }
        }
    }

    catch (UddiException uddiEx)
    {
        Console.WriteLine(String.Concat("UDDI error: ", uddiEx.Message));
    }

    catch (Exception genEx)
    {
        Console.WriteLine(String.Concat("General exception: ", genEx.Message));
    }
}

The following example shows you how to use the Visual Basic .NET programming language by using this class to find a business.

Public Sub FindBusinessSample(ByVal myConn As Microsoft.Uddi.UddiConnection, _
                              ByVal businessName As String)

    Dim findBiz As Microsoft.Uddi.FindBusiness
    Dim bizList As Microsoft.Uddi.BusinessList
    Dim bizCount As Integer
    Dim bizInfo As Microsoft.Uddi.Businesses.BusinessInfo
    Dim bizName As Microsoft.Uddi.Name

    Try
        findBiz = New Microsoft.Uddi.FindBusiness(businessName)
        bizList = findBiz.Send(myConn)


        ' Display the results of the search.
        bizCount = bizList.BusinessInfos.Count

        Select Case bizCount

            Case 0
                Console.WriteLine("No results from the search.")

            Case 1
                Console.WriteLine(String.Concat("There is one business called ", _
                                                businessName))

            Case Else
                Console.WriteLine(String.Concat("There are ", _
                                                bizCount, _
                                                " businesses called ", _
                                                businessName, _
                                                "."))

        End Select

        ' Show each business name.
        For Each bizInfo In bizList.BusinessInfos
            For Each bizName In bizInfo.Names
                Console.WriteLine(bizName.Text)
            Next
        Next

        Catch uddiEx As Microsoft.Uddi.UddiException
            Console.WriteLine(String.Concat("UDDI error: ", uddiEx.Message))

        Catch ex As Exception
            Console.WriteLine(ex.GetType())

    End Try

End Sub

Platforms

Development Platforms

Target Platforms

Windows Server 2008, Windows Server 2003, Windows XP Professional, Windows Vista, Windows Server 2003 R2, Windows XP

See Also

Reference

FindBusiness Class
FindBusiness Members
Microsoft.Uddi Namespace