Event.SetFieldValue Method
Sets the value of a field in the event record.
Пространство имен: Microsoft.SqlServer.NotificationServices
Сборка: Microsoft.SqlServer.NotificationServices (in microsoft.sqlserver.notificationservices.dll)
Синтаксис
'Декларация
Public Sub SetFieldValue ( _
fieldName As String, _
newValue As Object _
)
public void SetFieldValue (
string fieldName,
Object newValue
)
public:
virtual void SetFieldValue (
String^ fieldName,
Object^ newValue
) sealed
public final void SetFieldValue (
String fieldName,
Object newValue
)
public final function SetFieldValue (
fieldName : String,
newValue : Object
)
Параметры
- fieldName
The name of the event field.
- newValue
The value for the event field.
Замечания
This method is provided for COM interoperability, to allow callers from unmanaged code to set field values for an event record. If not using COM interop, use the Item property to get and set values.
Пример
The following example shows how to use the SetFieldValue method in unmanaged Microsoft Visual Basic Scripting Edition (VBScript) code to set the value of an event field:
Dim myInstance, myApplication, myEvent
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"
Синхронизация потоков
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.
Платформы
Платформы разработки
Список поддерживаемых платформ см. в разделе Hardware and Software Requirements for Installing SQL Server 2005.
Целевые платформы
Список поддерживаемых платформ см. в разделе Hardware and Software Requirements for Installing SQL Server 2005.
См. также
Справочник
Event Class
Event Members
Microsoft.SqlServer.NotificationServices Namespace