how to wait for object with single threaded application

G

Guest

Hi just wondering if there is a way to set up a wait for object in vb.net as
if a put a delay in between the fill and the databind things work ok, but if
not the page is reloading without the updated information,(stored procedure
is taking too long to complete).

the time needed for this delay will change depending on the time the "stored
procedure" which will vary, takes to excecute.

dataadapter.Fill(dataset, "stored procedure") 'fill the dataset.
(delay -for loop)
datagrid.DataBind() 'bind the data grid.
This is related to a previous post, that did not include enough information.
thanks.
 
G

Guest

ok thanks for the information. Does seem like it would wait for the
procedure to finish, will have to figure out why the delay seems to be making
things work, the delay is between the fill and the datagrid bind.
 
J

John Saunders

Paul said:
Hi just wondering if there is a way to set up a wait for object in vb.net
as
if a put a delay in between the fill and the databind things work ok, but
if
not the page is reloading without the updated information,(stored
procedure
is taking too long to complete).

the time needed for this delay will change depending on the time the
"stored
procedure" which will vary, takes to excecute.

dataadapter.Fill(dataset, "stored procedure") 'fill the dataset.
(delay -for loop)
datagrid.DataBind() 'bind the data grid.

Paul,

DataAdapter.Fill is synchronous. When it returns, the data have all been
loaded. If a delay is helping things at all, it's for a different reason.

John Saunders
 
S

Scott Allen

Hi Paul:

The Fill method is going to block (wait) until it has the results from
the stored procedure. If there is a timeout it will throw an
exception. Any chance you have this code inside of a try catch that is
eating the exception?

Depending on which data provider you are using you can generally set a
timeout threshold (like the CommandTimeout property of a SqlCommand
object).
 
G

Guest

Hi Scott, thanks for the response, not sure what you mean by eating the
exception.
I am using a try, catch and stepped through it, does not seem to create an
exception,
try
several select commands like below
dataadapter.SelectCommand().Parameters("@param1").Value = somevalue
dataadapter fill
delay
datagrid bind
Catch ex As Exception
s_message = ex.Message()
End Try
The stored procedure builds the query dynamically based on inputs, and uses
the EXEC sp_executesql.
Think I will set the timeout period as well as this has not been set.
 
G

Guest

Seems to be working now without the delay, had something wrong with a
validator so removed it and added another. Thanks.
 
G

Guest

Seems to be working now without the delay, had something wrong with a
validator so removed it and added another. Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top