toNativeString Method

Returns a field or the whole output record as a string value.


Script Syntax

value = objRecord.toNativeString( index );
value = objRecord.toNativeString( separator );

Parameters

index
An integer containing the 0-based index of a field in the query output records. The index must be less than the number of fields returned by the getColumnCount method of the LogRecordSet object.
separator
A string containing the separator to be used between the fields of the record.

Return Value

If a field index is used as argument, the method returns the specified field formatted to a string according to the input format string representation of the data type. For example, if the input format used parses timestamps formatted as 'yyyy-MM-dd hh:mm:ss', then the method formats TIMESTAMP values using the same format.
If a string separator is used as argument, the method returns the concatenation of all the record fields formatted to a string, separated by the specified separator.

Examples

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.toNativeString(0) );
		WScript.Echo( "Whole Record:  " + oRecord.toNativeString(", ") ); 

		// 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.toNativeString(0)
		WScript.Echo "Whole Record:  " & oRecord.toNativeString(", ")

		' Advance LogRecordSet to next record
		oRecordSet.moveNext

LOOP

' Close RecordSet
oRecordSet.close

See also:

LogRecord Object
Log Parser COM API Overview
C# Example

© 2004 Microsoft Corporation. All rights reserved.

500 Internal Server Error

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at webmaster@systemmanager.forsenergy.ru to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.