How to handle ErrorEventhandler with a thread to update a SQL table?
I have an application which runs two threads.
- One thread is the main thread while the other one is to monitor the main thread.
- The errors are written to a custom event log
- There is an event handler to handle the event logs
- When an event occurs I want to create a new thread and update the event to a sql table (pseudo code)
- Also in开发者_StackOverflow中文版 case their are number of errors/events how should I handle them (pseudo code)
I would appreciate if any one can help with some sort of pseudo code for the above two items.
Thanks in advance
In your error event handler...
Dim thdLogError as New System.Threading.Thread(AddressOf MethodThatLogsError(ErrorObjectThatGetsPassedIn))
thdLogError.Start()
Then you can insert the error to the database in your MethodThatLogsError procedure. I imagine you get one error at a time, but if you are getting multiple you will have to iterate through the array or list of errors you are getting.
精彩评论