How to set sql timeout on the sqldatasource control

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi
I have a query which takes longer than the default (30seconds I guess) time
to process (I am using the full text index in a sql server stored
procedure!). The results are place on a web page using the gridview and the
sql datasource controls.

In .Net 1.1 I guess I would have used the command.timeout property (I
already know that the web.config httpRuntime executionTimeout setting and the
sql connection timeout don't affect this the timeout I'm getting)

I am wondering how I access the sql timeout property with these new .net 2.0
controls which are great by the way.

I am guessing that I somehow reach into a the equivalent of the sqlcommand
in the datasource_selecting event and set the property. Anyone done this or
have any ideas?
 
Hi,

Thank you for your post.

You can set the select command's timeout value in SqlDataSource's Selecting
event:

protected void SqlDataSource1_Selecting(object sender,
SqlDataSourceSelectingEventArgs e)
{
e.Command.CommandTimeout = 30;
}

Hope this helps.

Regards,
Walter Wang
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 

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

Back
Top