Go Back   Velocity Reviews > Newsgroups > ASP Net
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

ASP Net - How to set commandTimeout for ObjectDataSource (ASP.NET 2.0)?

 
Thread Tools Search this Thread
Old 04-29-2006, 04:10 PM   #11
Default Re: How to set commandTimeout for ObjectDataSource (ASP.NET 2.0)?


Hi Juan.

> It's simpler to set the Timeout in code :

I know that, however as I said I did not write any line of code -
everything was autogenerated by DataSet Designer. It would be great if
I could change this generated code by setting there timeout.
Unfortunately I cannot find this code. Morover I think that every time
I change something in my dataset then this code would be generated one
more time and my changes would be overridden.

Piotrek



Piotrek
  Reply With Quote
Old 05-22-2006, 06:17 PM   #12
usenetlex@yahoo.com
 
Posts: n/a
Default Re: How to set commandTimeout for ObjectDataSource (ASP.NET 2.0)?
Hey, did you ever figure this out?
I am having the same problem - in the DataSet desginer, I do not see a
way to set the CommandTimeout (just the CommandText, CommandType,
etc.).
Changing the code... well I would lose it on the next auto-generate.
And the command variables are private.
ARGH.



Piotrek wrote:
> Hi Juan.
>
> > It's simpler to set the Timeout in code :

> I know that, however as I said I did not write any line of code -
> everything was autogenerated by DataSet Designer. It would be great if
> I could change this generated code by setting there timeout.
> Unfortunately I cannot find this code. Morover I think that every time
> I change something in my dataset then this code would be generated one
> more time and my changes would be overridden.
>
> Piotrek




usenetlex@yahoo.com
  Reply With Quote
Old 05-23-2006, 07:10 AM   #13
Piotrek
 
Posts: n/a
Default Re: How to set commandTimeout for ObjectDataSource (ASP.NET 2.0)?
No I didn't. I just wrote my own DAL class instead of that one, which
was generated by DataSet Designer.

Piotrek



Piotrek
  Reply With Quote
Old 08-03-2007, 12:51 PM   #14
EJocys
Junior Member
 
Join Date: Aug 2007
Posts: 1
Exclamation RE: How to set commandTimeout for ObjectDataSource
Quote:
Originally Posted by Piotrek
HI all.

In my web site I have some ObjetDataSource. Its business object
property is set to my dataset I created in dataset designer (this
dataset has table adapter).

My question is: how can I set command time-out property for fill method
from this table adapter?

Thanks in advance,
Piotrek.

Here is your answer:

1. Open your Dataset (lets say MyDataSet.xsd file).
2. Double click on your table adapter (lets say MyTableAdapter)
Visual Studio will switch you to MyDataSet.cs file and will generate similar code for you:

Code:
namespace Company.Project.DataProvider { partial class MyDataSet { partial class MyDataTable { } } }

3. Now you need to add new property which will help to set command time-out for all commands controller by MyTableAdapter:

Code:
namespace Company.Project.DataProvider { partial class MyDataSet { partial class MyDataTable { } } } namespace Company.Project.DataProvider.MyDataSetTableAdapters { public partial class MyTableAdapter { public int CommandTimeout { set { for (int i = 0; (i < this.CommandCollection.Length); i = (i + 1)) { if ((this.CommandCollection[i] != null)) { this.CommandCollection[i].CommandTimeout = value; } } } } } }

4. Open ASPX page where you are using ObjetDataSource (lets say MyObjetDataSource
5. Select MyObjetDataSource, click with right-mouse on it and from menu choose Properties
6. Visual studio will open Properties window for MyObjetDataSource
On top of all properties list there is toolbar. Click lightning icon to see all events of MyObjetDataSource.
7. Double click on ObjectCreated event
8. Visual Studio will open source code of ASPX page and will generate event function for you:

Code:
protected void MyDataSource_ObjectCreated(object sender, ObjectDataSourceEventArgs e) { }

9. Create code which will set Command Timeout just after MyDataSource has been created created

Code:
protected void MyDataSource_ObjectCreated(object sender, ObjectDataSourceEventArgs e) { Company.Project.DataProvider.MyDataSetTableAdapters.MyTableAdapter adapter; adapter = (Company.Project.DataProvider.MyDataSetTableAdapters.MyTableAdapter)e.ObjectInstance; // Set command timeout to 2 minutes adapter.CommandTimeout = 120; }

Done.

Keywords: C#, commandTimeout, ObjectDataSource, DataSet, TableAdapter, Designer, Solution, Code Example, Resolved, www.jocys.com


EJocys

Last edited by EJocys : 08-03-2007 at 12:55 PM.
EJocys is offline   Reply With Quote
Old 04-16-2008, 08:54 PM   #15
BlahBlahBlah
Junior Member
 
Join Date: Apr 2008
Posts: 1
Unhappy
Hi EJocys,
That approach does not work for me.

The "code behind" for my XSD file is XML. In other words, I get as far as this step:
1. Open your Dataset (lets say MyDataSet.xsd file).
2. Double click on your table adapter (lets say MyTableAdapter)

Double-clicking my table adapter does nothing. When I right-click and select "View Code" I see only XML.

Anyone know what gives?


BlahBlahBlah
BlahBlahBlah is offline   Reply With Quote
Old 08-20-2008, 03:38 PM   #16
amchi
Junior Member
 
Join Date: Aug 2008
Posts: 1
Default
I made it work.
I had the same issue like you ... code view only showing XML junk.

Added a new PARTIAL class with namespace matching my TableAdapter.
Something like
Code:
namespace CAATTableAdapters { public partial class SomeTableAdapterInsideCAATTableAdapter { public int CommandTimeout { set { for (int i = 0; (i < this.CommandCollection.Length); i = (i + 1)) { if ((this.CommandCollection[i] != null)) { this.CommandCollection[i].CommandTimeout = value; } } } } } }

Then added following to my ObjectDataSource event
CAATDataSource_ObjectCreated

Code:
Dim adapter As New CAATTableAdapters.SomeTableAdapterInsideCAATTableAdapter adapter = CType(e.ObjectInstance, CAATTableAdapters.SomeTableAdapterInsideCAATTableAdapter) adapter.CommandTimeout = 300

And yes I mixed VB and C# .. it's all same to me.


amchi
amchi is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
viewstate MAC failed in asp.net 2.0 while postback the page azraffarveen Software 0 05-12-2009 03:24 PM
.NET 2.0 Web Apps / .NET 3.5 ASP.NET Apps - Differences/Similariti london1919 MCTS 1 12-08-2008 03:16 PM
ASP.NET: Asign Users in Roles(Array.IndexOf(Of String) method) msandlana Software 0 04-25-2008 06:37 AM
ASP.NET deadlock viktoria Software 0 07-05-2007 02:53 AM
ASP.NET 2.0 application does not run in WIN2k3 johnfraj Software 0 04-19-2007 08:27 AM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46