Subscription.GetFieldOrdinal Method
Returns the ordinal of a field in the subscription record.
命名空间: Microsoft.SqlServer.NotificationServices
程序集: Microsoft.SqlServer.NotificationServices (in microsoft.sqlserver.notificationservices.dll)
语法
声明
Public Function GetFieldOrdinal ( _
fieldName As String _
) As Integer
public int GetFieldOrdinal (
string fieldName
)
public:
virtual int GetFieldOrdinal (
String^ fieldName
) sealed
public final int GetFieldOrdinal (
String fieldName
)
public final function GetFieldOrdinal (
fieldName : String
) : int
参数
- fieldName
The name of the subscription field for which you want the ordinal returned.
返回值
An integer representing the zero-based field ordinal.
示例
The following examples show how to use the GetFieldOrdinal method to get the ordinal of a subscription field by providing the field name:
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));
线程安全
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.
平台
开发平台
有关支持的平台列表,请参阅安装 SQL Server 2005 的硬件和软件要求。
目标平台
有关支持的平台列表,请参阅安装 SQL Server 2005 的硬件和软件要求。
请参阅
参考
Subscription Class
Subscription Members
Microsoft.SqlServer.NotificationServices Namespace