Condividi tramite


Subscription.GetFieldName Method

Returns the name of a field in the subscription record.

Spazio dei nomi: Microsoft.SqlServer.NotificationServices
Assembly : Microsoft.SqlServer.NotificationServices (in microsoft.sqlserver.notificationservices.dll)

Sintassi

'Dichiarazione
Public Function GetFieldName ( _
    fieldOrdinal As Integer _
) As String
public string GetFieldName (
    int fieldOrdinal
)
public:
virtual String^ GetFieldName (
    int fieldOrdinal
) sealed
public final String GetFieldName (
    int fieldOrdinal
)
public final function GetFieldName (
    fieldOrdinal : int
) : String

Parametri

  • fieldOrdinal
    The zero-based ordinal of the subscription field for which you want the name returned.

Valore restituito

A String containing the field name.

Esempio

The following examples show how to use the GetFieldName method to get the name of a subscription field by providing the field ordinal:

Dim instanceName As String =  "Tutorial" 
Dim applicationName As String =  "Weather" 
Dim subscriptionClassName As String =  "WeatherCity" 
Dim fieldName As String =  "City" 
Dim ordinal As Integer =  2 
 
' Create the NSInstance object.
Dim testInstance As New NSInstance(instanceName)
 
' Create the NSApplication object.
Dim testApplication As New NSApplication( _
    testInstance, applicationName)
 
' Create the Subscription object.
Dim testSubscription As New Subscription( _
    testApplication, subscriptionClassName)
 
' Use the GetFieldName method to return a field name
Console.WriteLine("Name of field " + ordinal.ToString() + _
    ": " + testSubscription.GetFieldName(ordinal))
 
' Use the GetFieldOrdinal to return a field ordinal
Console.WriteLine("Ordinal for the " + fieldName + _
    " field: " + testSubscription.GetFieldOrdinal(fieldName))
string instanceName = "Tutorial";
string applicationName= "Weather";
string subscriptionClassName= "WeatherCity";
string fieldName = "City";
int ordinal = 2;

// Create the NSInstance object.
NSInstance testInstance = new NSInstance(instanceName);

// Create the NSApplication object.
NSApplication testApplication =
    new NSApplication(testInstance, applicationName);

// Create the Subscription object.
Subscription testSubscription =
    new Subscription(testApplication, subscriptionClassName);

// Use the GetFieldName method to return a field name
Console.WriteLine("Name of field " + ordinal.ToString() + ": " + 
    testSubscription.GetFieldName(ordinal));

// Use the GetFieldOrdinal to return a field ordinal
Console.WriteLine("Ordinal for the " + fieldName + " field: " +
    testSubscription.GetFieldOrdinal(fieldName));

Thread Safety

Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Piattaforme

Piattaforme di sviluppo

Per un elenco delle piattaforme supportate, vedere Requisiti hardware e software per l'Installazione di SQL Server 2005.

Piattaforme di destinazione

Per un elenco delle piattaforme supportate, vedere Requisiti hardware e software per l'Installazione di SQL Server 2005.

Vedere anche

Riferimento

Subscription Class
Subscription Members
Microsoft.SqlServer.NotificationServices Namespace