Subscription.GetFieldOrdinal Method
サブスクリプション レコード内のフィールドの序数を返します。
名前空間: Microsoft.SqlServer.NotificationServices
アセンブリ: Microsoft.SqlServer.NotificationServices (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
サブスクリプション フィールドの名前です。この名前に対応する序数が返されます。
戻り値
0 から始まる、フィールドの序数を表す整数値です。
使用例
GetFieldOrdinal メソッドを使用し、フィールドの名前を指定することによってサブスクリプション フィールドの序数を取得する例を次に示します。
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));
スレッド セーフ
この型の public static (Microsoft Visual Basic では共有 ) メンバは、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。
プラットフォーム
開発プラットフォーム
サポートされているプラットフォームの一覧については、「SQL Server 2005 のインストールに必要なハードウェアおよびソフトウェア」を参照してください。
対象プラットフォーム
サポートされているプラットフォームの一覧については、「SQL Server 2005 のインストールに必要なハードウェアおよびソフトウェア」を参照してください。
参照
関連項目
Subscription Class
Subscription Members
Microsoft.SqlServer.NotificationServices Namespace