Re: VB.Net Timeout Error
- From: "Mr. Arnold" <MR. Arnold@xxxxxxxxxx>
- Date: Mon, 15 Oct 2007 16:54:39 -0400
"Mike" <mikeuk@xxxxxxxxxxxx> wrote in message news:1192030755.578548.261940@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I am having a problem with a VB.Net 2.0 Windows application.
When the user selects an item in the lookup box, It uses ADO to
retrieve data into a SQLDataReader, It then bind's this to a data
grid. This works fine normally and the stored procude will take less
than a second to run. I am also closing and disposing the connection
at then end of the task.
Problem comes if you leave the application open for a few minutes not
doing anything then come back to it. When you come back and click the
lookup box or try anthing else which uses ADO in the application, you
get:
Timeout expired. The timeout period elapsed prior to completion of
the operation or the server is not responding.
Can anybody shed any light on this?
From what I understand, when using a SQLDataReader, the connection maystill be open due to the reader has not read all of the records, and it has to go back and read more records. The connection is still open.
You can use a strong named collection of objects or an ArrayList of objects with the SQLDataReader, populate an object representing the data, put each object into a strong named collection or ArrayList and bind the collection or ArrayList to the control. Or you can use a Dataset, set a Datatable to the Dataset, and bind the Datatable to the control. In either of the cases, the data is in memory, as opposed to using a DataReader where the connection may still be open when bound to the control to read more records.
This is the reason MVP (Model View Presenter) is becoming popular now, because this eliminates the direct connection or call from the UI to a database. where as, one has the UI/MVP/Business layer/Data Access layer with each layer being abstracted from the other or loosely coupled.
They also have the <List> in .Net 2005 too.
.
- References:
- VB.Net Timeout Error
- From: Mike
- VB.Net Timeout Error
- Prev by Date: Re: Bug? Graphics.DrawImage throws "Out of Memory" Exception
- Next by Date: Derived Combobox with Locked/Readonly Property working until Databind
- Previous by thread: VB.Net Timeout Error
- Next by thread: bounded MaskedTextBox allow user to enter empty value to date
- Index(es):
Relevant Pages
|