I'm trying to fill a dataset, but I want to limit the amount of time the system has to fill this dataset to 30 seconds.
I have tried (as suggested elsewhere on SO):
Dim T As Date = Date.Now
da.Fill(ds, "DATASET")
Do
If (Date.Now - T).TotalSeconds >= 30 Then
Main.VIEW_Title.Text = "Error In Connection..."
Exit Sub
End If
Exit Do
Loop
But the system just hangs anyway during the da.Fill(ds, "DATASET")
section and doesn't ever exectute the "Error In Connection" message. It doesn't matter if I put the line inside the DO
either, because it stops there. What I need is for it to execute the fill command, and then if it doesn't complete in 30 seconds, to allow me to handle that error.
Thanks