Returns the value of the field at the specified position in the record.
value = objRecord.getValue( index );
value = objRecord.getValue( fieldName );
Field Type | VARIANT Type | JScript Type | VBScript Type |
---|---|---|---|
INTEGER | VT_I4 | number | Long |
REAL | VT_R8 | number | Double |
STRING | VT_BSTR | string | String |
TIMESTAMP | VT_DATE | date (VB date) | Date |
NULL | VT_NULL | null object | Null |
JScript example:
var oLogQuery = new ActiveXObject("MSUtil.LogQuery"); // Create query text var strQuery = "SELECT TimeGenerated, SourceName, EventID, Message FROM System"; // Execute query and receive a LogRecordSet var oRecordSet = oLogQuery.Execute( strQuery ); // Visit all records while( !oRecordSet.atEnd() ) { // Get a record var oRecord = oRecordSet.getRecord(); // Display record information WScript.Echo( "TimeGenerated: " + oRecord.getValue("TimeGenerated") ); WScript.Echo( "SourceName : " + oRecord.getValue(1) ); WScript.Echo( "EventID : " + oRecord.getValue(2) ); if( !oRecord.isNull(3) ) { WScript.Echo( "Message : " + oRecord.getValue(3) ); } else { WScript.Echo( "Message : <null>" ); } // Advance LogRecordSet to next record oRecordSet.moveNext(); } // Close LogRecordSet oRecordSet.close();VBScript example:
Dim oLogQuery Dim oRecordSet Dim strQuery Dim f Dim val Set oLogQuery = CreateObject("MSUtil.LogQuery") ' Create query text strQuery = "SELECT TimeGenerated, SourceName, EventID, Message FROM System" ' Execute query and receive a LogRecordSet Set oRecordSet = oLogQuery.Execute( strQuery ) ' Visit all records DO WHILE NOT oRecordSet.atEnd ' Get a record Set oRecord = oRecordSet.getRecord ' Display record information WScript.Echo "TimeGenerated: " & oRecord.getValue("TimeGenerated") WScript.Echo "SourceName : " & oRecord.getValue(1) WScript.Echo "EventID : " & oRecord.getValue(2) If oRecord.isNull(3) = False Then WScript.Echo "Message : " & oRecord.getValue(3) Else WScript.Echo "Message : <null>" End If ' Advance LogRecordSet to next record oRecordSet.moveNext LOOP ' Close RecordSet oRecordSet.close
© 2004 Microsoft Corporation. All rights reserved.