Event.GetFieldValue Method
Returns the value of a field in the event record.
命名空间: Microsoft.SqlServer.NotificationServices
程序集: Microsoft.SqlServer.NotificationServices (in microsoft.sqlserver.notificationservices.dll)
语法
声明
Public Function GetFieldValue ( _
fieldName As String _
) As Object
public Object GetFieldValue (
string fieldName
)
public:
virtual Object^ GetFieldValue (
String^ fieldName
) sealed
public final Object GetFieldValue (
String fieldName
)
public final function GetFieldValue (
fieldName : String
) : Object
参数
- fieldName
The name of the event field for which you want the value returned.
返回值
An object that represents the field's value.
备注
This method is provided for COM interoperability, to allow callers from unmanaged code to get field values from an event record.
示例
The following example shows how to use the GetFieldValue method in unmanaged Microsoft Visual Basic Scripting Edition (VBScript) code to get the value of an event field:
Dim myInstance, myApplication, myEvent, fieldValue
const instanceName = "MyInstanceName"
const applicationName = "MyApplicationName"
const eventClassName = "MyEventClassName"
const eventFieldName = "MyEventFieldName"
'Create & initialize an NSInstance object.
set myInstance = WScript.CreateObject("Microsoft.SqlServer.NotificationServices.NSInstance")
myInstance.Initialize instanceName
'Create & initialize an NSApplication object.
set myApplication = WScript.CreateObject("Microsoft.SqlServer.NotificationServices.NSApplication")
myApplication.Initialize (myInstance), applicationName
'Create & initialize an Event object.
set myEvent = WScript.CreateObject("Microsoft.SqlServer.NotificationServices.Event")
myEvent.Initialize (myApplication), eventClassName
'Use the SetFieldValue method to set a field value.
myEvent.SetFieldValue eventFieldName, "Test"
'Use the GetFieldValue method to return a field value.
fieldValue = myEvent.GetFieldValue(eventFieldName)
WScript.Echo "Field Value = " + fieldValue
线程安全
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 的硬件和软件要求。
请参阅
参考
Event Class
Event Members
Microsoft.SqlServer.NotificationServices Namespace