SqlDataSource - command timeout?

S

Sasa .

Hello,

I was wondering if it is possible to set command timeout for the
SQLDataSource control. Documentation on this topic is scarce and I
could not find anything on the internet either. Anybody has an idea?

Thanks,
Sasa .
 
S

Sasa .

As the selectQuery of my SQLDataSource control I have a parameterized
query that depending on parameters supplied sometimes takes quite a
long time to execute.

SQLDataSource control is a data source for GridView control.
Sometimes, using this setup, I get error:
"System.Data.SqlClient.SqlException: Timeout expired."

If I bind GridView to say SqlDataReader that is created
programmatically, I can set up command timeout to any desired value
and get the thing working without problems. However, I would like to
use SQLDataSource control as data source but I do not know how to set
up command timeout... Idea, anybody?

Sasa .
 
W

WertmanTheMad

I found it in case anyone at a later date looks for this.

Add a Selecting Event to the SqlDataSource and then add

the following to the Selecting

e.Command.CommandTimeout = 5000 'For example

Have Fun

Chris
 

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

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top