Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Detect Event Viewer Keywords null value
Message
From
09/01/2017 08:05:33
 
 
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
VB 9.0
OS:
Windows 8.1
Network:
Windows Server 2012
Database:
Visual FoxPro
Application:
Web
Miscellaneous
Thread ID:
01646401
Message ID:
01646410
Views:
30
>Don't understand your question. Firstly, you are casting to loEventLogRecord but not using it in subsequent code. And what is the value of loEventRecord and loEventRecord.Keywords when the if statement executes ?

Here is more information.

The initialization of various event records is done here:
' Initialization
loEventRecord = loEventLogReader.ReadEvent()

' For each record
While Not loEventRecord Is Nothing

   ' Cast the EventRecord object as an EventLogRecord object to access the EventLogRecord class properties
   loEventLogRecord = CType(loEventRecord, EventLogRecord)
Most of the event log record properties are accessed by using loEventRecord. However, when we have a property which contains several items, we have to use it like this:
' Reset the values
lcFinal = ""

' For each keyword
For Each lcString In loEventLogRecord.KeywordsDisplayNames

   ' If we have a string
   If lcFinal.Length > 0 Then
      lcFinal = lcFinal + ", "
   End If

   lcFinal = lcFinal + lcString
Next

loInsertRow.ParameterAdd("KeywordDisplayName", lcFinal)
Properties such as Level, Id, ProviderName, FormatDescription, just to name a few, are accessed directly from loEventRecord. But, properties KeywordDisplayNames and Properties need to be accessed from loEventLogRecord.

The event log record contains various structures. Also, some of them can return null. Version, for example, can be detected for null by using is IS NOTHING comparism. But, Keywords is not supporting that. So, if I just replace that as is in the table field, into which I transfer that into a SQL Server table format, I will end up with null. And, I don't want null. I need to put a 0 in there, as Keywords, which represents a Long value, when it is null, need to be represented as 0 in my table.

I think the problem comes from the fact that this is a Long. There has to be a way to detect a null value in such circumstance.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform