|
I have a class (Query) that dimensions a new background worker and a new oracle connection. Each instance of the query class is supposed to query the database, wait a specific amount of time then query again. The first time a trigger an event (which creates a new instance of the query), the background worker RunWorkerCompleted event will not fire, however everytime I trigger an event after that (whether its the same one or a different one), the event will work fine. If I remove the oracle database connection instance (and all related code), this problem goes away. Does this make any sense to anyone. I dont even need to use the connection instance, as long as I try to create a new one, this keeps happening. I am so confused!
Any help would be great
Public Class Query
Implements IDisposable
Private m_trigger_time as Datetime
Private m_cfg as TriggerCfg
Private m_handle as System.Threading.AutoResetEvent
Pivate m_connection As Client.OracleConnection
Private WithEvents m_bgworker as System.ComponentModel.BackgroundWorker
Public Sub New(ByRef cfg as TtriggerCfg, ByVal time as DateTime)
m_cfg = cfg
m_trigger_time = time
m_handle = New System.Threading.AutoResetEvent(False)
m_bgworker = New System.ComponentModel. BackgroundWorker
m_connection = New Client.OracleCOnnection(My.Settings.OraConnectionString.ToString)
m_bgworker.RunWorkerAsync
End Sub
Private TriggerAction(ByVal sender as Object, ByVal e as System.ComponentModel.DoWorkEventArgs) Handles m_bgworker.DoWork
...Do db query
m_handle.Wait(New TimeSpan(0,0,10),False)
...Do db query
End Sub
Private Sub Completed(ByVal sender as Object, ByVal e as System.ComponentModel.RunWorkerCompletedEventsArgs) Handles m_bgworker.RunWorkerCompleted
Dim worker as System.ComponentModel.BackgroundWorker = Ctype(sender, System.ComponentModel.BackgroundWorker)
If e.Error IsNot Thing Then
MsgBox(e.Error.Message)
Else If e.Cancelled Then
MsgBox("Cancelled")
Else
Me.Dispose()
End Sub
End Class
|
|
|
|
|
Hello all -
this might be a basic question but I can't seem to get the answer right. I have a byte array which needs to be converted to specific data types. I am using the BitConverter class for the conventional conversion such as Int16, Int32 etc. Some of the parameters in the array cannot be converted directly to the specific integer types using the BitCOnverter methods. For example -
parameter1 is the first 3 bytes in the array and needs to be Uint32 for decoding purposes. If I use the convert to Uint32 method - it automatically takes the first 4 bytes. Is there a way to convert just those 3 bytes.
same is true for the next parameter which is only 1 byte but again needs to be Uint32.
Thanks a million
|
|
|
|