473,808 Members | 2,873 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to set commandTimeout for ObjectDataSourc e (ASP.NET 2.0)?

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 timeout property for fill method
from this table adapter?

Thanks in advance,
Piotrek.

Apr 4 '06 #1
12 9807
Anybody?

Apr 25 '06 #2
jd
The timeout is normally set in the connection string. I don't know if
there's another place to specify it. If you want to use the same
timeout everywhere in your program, then just set the timeout value
globally. If you want to use different timeouts in different places,
you can dynamically build the connection string (note, however, that
this may reduce the effectiveness of connection pooling).

Hope this helps...

-- jeff

Apr 25 '06 #3
Thanks jd.

However, I don't want to set Connection timeout but Command timeout. In
connection string only Connection timeout can be set.

Piotrek

Apr 26 '06 #4
jd
How about setting the CommandTimeout property?

-- jeff

Apr 26 '06 #5
Jd, that's exaclty what I want to do.

Just tell me, where I can find this CommandTimeout property (remember,
that I use auto generated table adapters).

Piotrek

Apr 27 '06 #6
It's fine to use autogenerated code, but at some point you need to tweak it.
In this case, you have code that creates a TableAdapter. A TableAdapter is a
wrapper for a DataAdapter. The DataAdapter in the Table Adapter has 4
different Command objects associated with it, one each for inserting,
selecting, updating, and deleting. The Command object has the CommandTimeout
property which can be used to adjust this.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Hard work is a medication for which
there is no placebo.

"Piotrek" <pt*********@po czta.fm> wrote in message
news:11******** **************@ g10g2000cwb.goo glegroups.com.. .
Jd, that's exaclty what I want to do.

Just tell me, where I can find this CommandTimeout property (remember,
that I use auto generated table adapters).

Piotrek

Apr 27 '06 #7
You can't set it globally, so you must set it for each Command object.

The Command object has a CommandTimeout property you can set.

See examples at :
http://msdn.microsoft.com/library/de...meouttopic.asp


Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== =====
"Piotrek" <pt*********@po czta.fm> wrote in message
news:11******** **************@ g10g2000cwb.goo glegroups.com.. .
Jd, that's exaclty what I want to do.

Just tell me, where I can find this CommandTimeout property (remember,
that I use auto generated table adapters).

Piotrek

Apr 27 '06 #8
Thanks for all answers.

I created a partial class, in which there is a SelectCommandTi meout
property:
namespace DataSetPayments TableAdapters
{
public partial class P_RWI_PAYMENTS_ SEARCHTableAdap ter
{
public int SelectCommandTi meout
{
get
{
return (this._commandC ollection[0].CommandTimeout );
}
set
{
for (int i = 0; i < this._commandCo llection.Length ;
i++)
{
if ((this._command Collection[i] != null))
{

((System.Data.S qlClient.SqlCom mand)(this._com mandCollection[i])).CommandTimeo ut
= value;
}
}
}
}
}
}

My solution compiles without errors, but I do not how to call this
newly created property from the page, on which I have my
ObjectDataSourc e.

I would like to do sth like that (e.g. in the Page_Load event):
P_RWI_PAYMENTS_ SEARCHTableAdap ter.SelectComma ndTimeout = 180
but this TableAdapter is not seen in IntelliSense.

Piotrek

Apr 27 '06 #9
re:
I would like to do sth like that (e.g. in the Page_Load event):
P_RWI_PAYMENTS_ SEARCHTableAdap ter.SelectComma ndTimeout = 180
but this TableAdapter is not seen in IntelliSense.
It's simpler to set the Timeout in code :

<DataObjectMeth od(DataObjectMe thodType.Delete )> _
Public Shared Function DeleteEmployee( EID As Integer) As Boolean

If Not _initialized Then Initialize()

Dim conn As SqlConnection = New SqlConnection(_ connectionStrin g)
Dim cmd As SqlCommand = New SqlCommand("DEL ETE FROM E WHERE EID = @EmployeeID", conn)
cmd.CommandTime out = 20
cmd.Parameters. Add("@EmployeeI D", SqlDbType.Int). Value = EID

Try
conn.Open()

If cmd.ExecuteNonQ uery() <> 0 Then _
Return False
Catch e As SqlException
' Handle exception.
Finally
conn.Close()
End Try

Return True
End Function

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== =====
"Piotrek" <pt*********@po czta.fm> wrote in message
news:11******** **************@ i40g2000cwc.goo glegroups.com.. . Thanks for all answers.

I created a partial class, in which there is a SelectCommandTi meout
property:
namespace DataSetPayments TableAdapters
{
public partial class P_RWI_PAYMENTS_ SEARCHTableAdap ter
{
public int SelectCommandTi meout
{
get
{
return (this._commandC ollection[0].CommandTimeout );
}
set
{
for (int i = 0; i < this._commandCo llection.Length ;
i++)
{
if ((this._command Collection[i] != null))
{

((System.Data.S qlClient.SqlCom mand)(this._com mandCollection[i])).CommandTimeo ut
= value;
}
}
}
}
}
}

My solution compiles without errors, but I do not how to call this
newly created property from the page, on which I have my
ObjectDataSourc e.

I would like to do sth like that (e.g. in the Page_Load event):
P_RWI_PAYMENTS_ SEARCHTableAdap ter.SelectComma ndTimeout = 180
but this TableAdapter is not seen in IntelliSense.

Piotrek

Apr 27 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
8708
by: Jim Hammond | last post by:
I am passing the whole object instead or parameters in my select and update methods. I can get the updated object if I set UpdateMethod, let ASP.NET autogenerate an update button, and then press update after making changes, but I don't want that update button. How can I get the updated object when the user presses one of my other action buttons?
5
1992
by: Ole M | last post by:
I'm having some trouble using the ObjectDataSource in ASP.NET 2.0. I have a wrapper that contains the static methods for Select and Update. The Update-method takes the business object as parameter. When the Update-method is invoked by the ObjectDataSource, the object referenced is not the same object returned by the Select-method, but a new object with only the values from the Edit-template. So basically I get a reference to a useless...
3
2655
by: avezina | last post by:
We would like to use those new cool features of Asp.Net 2.0 like the ObjectDataSource in our project. I tried few basics examples and its work well. Let's say I have a page that displays a detail of a product. On my page I have a product name and a short description. So I declare an ObjectDataSource in my page <asp:ObjectDataSource ID="productData" runat="server" SelectMethod="GetProduct"
0
1892
by: Northern | last post by:
Hello, I have some trouble to declare and instantiate dynamically an ObjectDataSource in the codebehind file. The idea is to bind the objectdatasource to a gridview and have automate sorting and paging. The objectdatasource SelectMethod returns a dataview. When my objectdatasource is declared in the codebehind, sorting is not working and i receive following error when clicking on a datagrid's column header. I made the same test...
0
6994
by: Bryce Fischer | last post by:
I've got a simple (I think) asp.net application. I've created a DataSet in App_Code/ItemDataSet.xsd. Tested connection, seemed to work fine. In my ASPX file, I first dropped an ObjectDataSource onto the form, and pointed it to the dataset created above. I then dropped a GridView on the form, and selected the ObjectDataSource I created above. In the Design view it seems to be at least loading the
5
2659
by: Randy Smith | last post by:
Hi ALL, I wonder if anyone has been using n-tier to bind to a GridView control by using the ObjectDataSource. This is our first OOP web application, and we have no tables. Right now we are simply working with objects in memory. So, it appears as though Microsoft requires that our datamapper classes reside inside a folder called "App_Code", and NO WHERE ELSE. So, has anyone successfully been able to place their datamappers in a...
0
2191
by: GMartin | last post by:
I have a pop-up form with a three columned Grid that has checkboxes in a Template Column in the first/left-most column. (The form is to allow users to select "Members" of a group, where they check or clear the boxes next to the potential members they want to add or remove.) The Object Data Source is as follows... <asp:ObjectDataSource ID="odsMembers" runat="server" SelectMethod="GetGroupMembersSelectList"...
0
5525
by: Phillip Ian | last post by:
Tried this over in CSharp.General and didn't get anything, so I thought I'd try again here. If there's an AJAX specific group I could ask this in, please let me know...I did look. I'm trying to code what I think is a fairly typical Master/Detail scenario with two GridViews, using AJAX. Using the Northwind sample, I have two ObjectDataSources - one which pulls data from the Orders table, and one that pulls the related data from . Each...
3
11196
by: btreddy | last post by:
Hii all, I've a problem regarding passing select parameters to objectdatasource from code behind. i would like to pass the select parameters to a objectdatasource ..not in the selecting or selected event of the objectdatasource but some where in the one of button click event. i tried of adding the parameters but it didn work for me.. <asp:ObjectDataSource ID="ODSEditSchedules" TypeName="Schedules" runat="server"...
0
9721
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9600
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10113
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9195
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7651
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6880
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5685
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4331
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3859
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.