Link to home
Start Free TrialLog in
Avatar of deno2
deno2

asked on

Processing your request... SQL Timeout

Hi,

I have an asp.net page that runs a stored procedure on SQL Server 2000. The trouble is that the query can take over a minute to run and I get the following exception:

"System.Data.SqlClient.SqlException: Timeout expired."

What I want to know is:

   - How do I display a "Please wait we are processing your request..." notice while the query is running.

and

   - How do I increase the timeout from the 30 second default.

I have tried but without success.
Avatar of mmarinov
mmarinov

for displaing message you can use this scenario
Label.Text = "Please wait we are processing your request...";
Response.Flush()
call the stored procedure

to increase the timeout
you have to use
SqlConnection con = new SqlConnection();
con.ConnectionTimeout = 1200; //for example

HTH
B..M
Avatar of deno2

ASKER

I've tried that but now my code won't compile.

I get:

C:\Inetpub\wwwroot\e\Components\Comparisons.cs(26): Property or indexer 'System.Data.SqlClient.SqlConnection.ConnectionTimeout' cannot be assigned to -- it is read only
SOLUTION
Avatar of mmarinov
mmarinov

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of deno2

ASKER

I did:

// set timeout
myCommand.SelectCommand.CommandTimeout = 1200;

and it worked fine. Thanks for the help with that - it's been bugging me for ages.

I'm still having trouble with:

Label.Text = "Please wait we are processing your request...";
Response.Flush();

It's as if the response.flush part is not doing it's job. The message is not displayed until the query has finished.

Ideally, this is what I want to happen.

- User clicks button on form.

- Screen clears and message is displayed.

- Query runs.

- Query Finishes.

- Message is removed.

- Form and Results are displayed.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial