C
Chris Williamson
Could anyone suggest the best method to create a thread that will process
events?
I need to create a thread that calls the SQLDMO.Backup.SQLBackup method
(which is asyncrhonous). SQLBackup raises the Complete event, but I need it
to be executed by the spun thread, not the main form's thread. After the
backup is done (after calling SQLBackup for each database - syncrhonously)
the thread will raise an event to the main form.
Raising the event on the main form and passing it to the thread is not
legitamate. I cannot rely on the main form as this is going into an object
and I cannot rely there being a form (it may be a console app, or the form
may be busy doing something else that will hold up beginning a backup on
another database).
I've gotten around this by creating a hidden form within my backup object
and hidden it. But I see that as wasted resources and possible trouble down
the road (console app, service, or asp.net app). Is there a better way for
me to do this? Could I get away with inheriting
System..ComponentModel.Component?
Thank you,
Chris Williamson
events?
I need to create a thread that calls the SQLDMO.Backup.SQLBackup method
(which is asyncrhonous). SQLBackup raises the Complete event, but I need it
to be executed by the spun thread, not the main form's thread. After the
backup is done (after calling SQLBackup for each database - syncrhonously)
the thread will raise an event to the main form.
Raising the event on the main form and passing it to the thread is not
legitamate. I cannot rely on the main form as this is going into an object
and I cannot rely there being a form (it may be a console app, or the form
may be busy doing something else that will hold up beginning a backup on
another database).
I've gotten around this by creating a hidden form within my backup object
and hidden it. But I see that as wasted resources and possible trouble down
the road (console app, service, or asp.net app). Is there a better way for
me to do this? Could I get away with inheriting
System..ComponentModel.Component?
Thank you,
Chris Williamson