Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How to set commandTimeout for getData method of TableAdapter (ASP.NET 2.0)?

Reply
Thread Tools

How to set commandTimeout for getData method of TableAdapter (ASP.NET 2.0)?

 
 
Piotrek
Guest
Posts: n/a
 
      04-11-2006
Hi all.

I am developing some web application in which I use datasets, which
were generated using dataSetDesigner. My dataset has a TableAdapter,
which has GetData method. Users of my application sometimes get timeout
while executing this GetData method.

I would like to increase CommandTimeout for this GetData method, but I
cannot find this property. How can I do that?

Thanks in advance,
Piotrek

 
Reply With Quote
 
 
 
 
Brock Allen
Guest
Posts: n/a
 
      04-11-2006
You could alter the connection string used to initialize the DataAdapter
to include the timeout desired.

-Brock
http://staff.develop.com/ballen


> Hi all.
>
> I am developing some web application in which I use datasets, which
> were generated using dataSetDesigner. My dataset has a TableAdapter,
> which has GetData method. Users of my application sometimes get
> timeout while executing this GetData method.
>
> I would like to increase CommandTimeout for this GetData method, but I
> cannot find this property. How can I do that?
>
> Thanks in advance,
> Piotrek



 
Reply With Quote
 
 
 
 
Piotrek
Guest
Posts: n/a
 
      04-12-2006
Hi Brock

I am not sure if it is possible to set CommandTimeout in the connection
string. In my opinion only connectionTimeout can be set there.

Piotrek

 
Reply With Quote
 
Brock Allen
Guest
Posts: n/a
 
      04-12-2006
I thought those were the same?

In any event, you can access the command timeout via: DataAdapter.SelectCommand.CommandTimeout.

-Brock
http://staff.develop.com/ballen


> Hi Brock
>
> I am not sure if it is possible to set CommandTimeout in the
> connection string. In my opinion only connectionTimeout can be set
> there.
>
> Piotrek
>



 
Reply With Quote
 
Piotrek
Guest
Posts: n/a
 
      04-13-2006
I am afraid not.
Try it with TableAdapter and some Fill or GetData method.

Piotrek

 
Reply With Quote
 
SalimMorgan SalimMorgan is offline
Junior Member
Join Date: May 2006
Posts: 2
 
      05-31-2006
The only way to change this from the default of 30 seconds is to use partial classes to extend the table adapter class.

The latter is generated code which you can find by using "Go to Definition" within VS. Note that it is already a partial class. Create your own file and use the same namespace and partial class name. Next, add a property for CommandTimeout as follows:

public partial class xxxxxxTblTableAdapter
{
public int SelectCommandTimeout
{
get
{
return this.CommandCollection[0] .CommandTimeout;
}
set
{
this.CommandCollection[0].CommandTimeout = value;
}
}
}
 
Reply With Quote
 
SalimMorgan SalimMorgan is offline
Junior Member
Join Date: May 2006
Posts: 2
 
      05-31-2006
Don't forget to get the namespace from the TA file, which I didn't put in the code snippet. After you create this partial class file, you can set the CommandTimeout after instantiating your TableAdapter and before calling GetData() like this:

tbladptr.SelectCommandTimeout = 300;
 
Reply With Quote
 
robwafle robwafle is offline
Junior Member
Join Date: Aug 2006
Posts: 1
 
      08-15-2006
Thanks! I was trying to figure that out!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to set commandTimeout for ObjectDataSource (ASP.NET 2.0)? Piotrek ASP .Net 15 08-20-2008 02:38 PM
CommandTimeout, ConnectionTimeout, httpRuntime executionTimeout (ASP.NET 2.0) Piotrek ASP .Net 4 04-15-2008 10:02 AM
Formatted MAC OSX Partition using NTFS - Need to reverse that and getdata files back... Can You Help? pspuser Computer Support 3 01-22-2008 09:27 AM
dataTransfer.setData() and .getData() commands in FireFox? dwhalen Javascript 4 02-22-2007 07:32 PM
XML Schema CommandTimeout UnglueD ASP .Net 1 08-31-2006 02:22 PM



Advertisments