|
-
Jan 6th, 2003, 02:57 PM
#1
Thread Starter
Lively Member
Threading and Loops
I need to loop through a data reader and spawn a seperate thread for each item within the set. You can see my code below, but it does not appear to work as I thought. This application is running as windows service and this block of code executes via a timer. Any help or ideas would be GREATLY appreciated...
Dim oDataReader As SqlDataReader
Dim BootClass As New BootClass()
Try
If SQLCheck() Then
Dim oCmd As New SqlCommand("BootGet", SQLConnObj)
oDataReader = oCmd.ExecuteReader()
While oDataReader.Read()
Dim bootThread As New Thread(AddressOf BootClass.Reboot)
BootClass.Server = oDataReader("Server")
BootClass.Key = oDataReader("PKey")
BootClass.Notify = oDataReader("Notify")
bootThread.IsBackground = True
bootThread.Name = "thd_" & Rnd()
bootThread.Start()
End While
oDataReader.Close()
Catch ex as exception
'Do nothing in example
End try
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|