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