DatabaseProvider.GetDatabaseHostName Method

Returns the host name of the computer where the database in the connection string is located.

Namespace: Microsoft.Web.Management.DatabaseManager
Assembly: Microsoft.Web.Management.DatabaseManager (in Microsoft.Web.Management.DatabaseManager.dll)

Syntax

'Declaration
Public MustOverride Function GetDatabaseHostName ( _
    connectionString As String _
) As String
'Usage
Dim instance As DatabaseProvider
Dim connectionString As String
Dim returnValue As String

returnValue = instance.GetDatabaseHostName(connectionString)
public abstract string GetDatabaseHostName(
    string connectionString
)
public:
virtual String^ GetDatabaseHostName(
    String^ connectionString
) abstract
public abstract function GetDatabaseHostName(
    connectionString : String
) : String

Parameters

  • connectionString
    Type: System.String
    The connection string for the database connection.

Return Value

Type: System.String
A string that contains the host name for the computer where the database is located.

Remarks

Your provider must implement the GetDatabaseHostName method in order to return the host name of the computer that is hosting the database for your provider.

Examples

The following code sample illustrates an example GetDatabaseHostName method that returns the host name of the database.


    Public Overrides Function GetDatabaseHostName( _
            ByVal connectionString As String) As String

        Return System.Environment.MachineName

    End Function


        // Retrieve the hostname for the database server.
        public override string GetDatabaseHostName( string connectionString )
        {
            // Return the computer name.
            return System.Environment.MachineName;
        }

Permissions

See Also

Reference

DatabaseProvider Class

Microsoft.Web.Management.DatabaseManager Namespace