i implemented a thread using the code below. The get device sql query takes 12 seconds to execute and then binds to a dropdownlist. i figured if i spawn it on a different thread, i would gain time becuase it is executing in paralell. I havent seen those gains. Can you help
VB.NET:
Dim threadSimpleExtract As Thread
threadSimpleExtract = New Thread(AddressOf Get_DeviceType)
threadSimpleExtract.Name = "Data"
threadSimpleExtract.ApartmentState = ApartmentState.MTA
threadSimpleExtract.CurrentPrincipal = HttpContext.Current.User
threadSimpleExtract.IsBackground = True
threadSimpleExtract.Priority = ThreadPriority.Highest
threadSimpleExtract.Start()
right before the page load i do
threadSimpleExtract.Join()
VB.NET:
Get device code
Dim dbBAM As New BeAManager.Database
Dim prBAM(2) As OracleClient.OracleParameter
Dim prBAM1(1) As OracleClient.OracleParameter
Dim drBAM As OracleClient.OracleDataReader
Dim wi As System.Security.Principal.WindowsImpersonationContext = Global.ApplicationIdentity.Impersonate()
' SyncLock cboDeviceType.GetType
prBAM1(0) = dbBAM.MakeParameter("P_Study", studyID)
prBAM1(1) = dbBAM.MakeOutputParameter("OCursor")
dbBAM.RunProcedure("CRIS_S_DEVICETYPE", prBAM1, drBAM)
cboDeviceType.DataTextField = "DEVICENAME"
cboDeviceType.DataValueField = "ITEMID"
cboDeviceType.DataSource = drBAM
cboDeviceType.DataBind()
cboDeviceType.Items.Insert(0, "-Select Device Type-")
drBAM.Close()
drBAM.Dispose()
dbBAM.Close()
dbBAM.Dispose()
' End SyncLock
wi.Undo()