This code:
private void GetPlans(){
dt = dt.Clone(); //New object?
cn.Open();
SqlDataReader drd = cmdGetPlans.Exe cuteReader();
if (drd.HasRows){
while (drd.Read()){
dt.Rows.Add(new Object[] {drd["JobID"].ToString(),//where the problem
happens
drd["CustName"].ToString()});
}
}
cn.Close();
}
Works instantly, but this code (Only the second line is different):
private void GetPlans(){
dt.Rows.Clear() ;
cn.Open();
SqlDataReader drd = cmdGetPlans.Exe cuteReader();
if (drd.HasRows){
while (drd.Read()){
dt.Rows.Add(new Object[] {drd["JobID"].ToString(),
drd["CustName"].ToString()});
}
}
cn.Close();
}
Takes an eternal seeming 1.75 seconds to fill the first row the 2nd
time it's called.
Behavior is the same if I use a SqlDtaAdapter and DataSet. Only the
second time is that slow, the first call and all subsequent calls are
virtually instantaneous.
dt is a DataTable and is bound to a ComboBox(this is a critical part of
the problem) The sitution is the same databinding a dataset table to a
listbox, combobox or other like objects, or even just adding them from
a sqldatareader manually.
Can anyone tell me why?
TIA Bob Graham 2 1337
"RvGrah" <rv************ ****@sbcglobal. net> wrote in news:1119022019 .703508.195840
@o13g2000cwo.go oglegroups.com: if (drd.HasRows){
This line is not needed BTW. If there are not rows, read will return false anyways. In fact some
DB's cannot even detect if there are rows or not in their provider until you call read and simply
always return true for HasRows.
dt is a DataTable and is bound to a ComboBox(this is a critical part of the problem) The sitution is the same databinding a dataset table to a listbox, combobox or other like objects, or even just adding them from a sqldatareader manually.
There is a call, BeginUpdates or something like that. Try calling that before clear and dont foret to
call the end call too.
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programmin g is an art form that fights back"
Develop ASP.NET applications easier and in less time: http://www.atozed.com/IntraWeb/
I've tried adding the items directly to a listbox, using
ListBox.BeginUp date() and EndUpdate as well as many other methods, but
it seems any method where you fill or databind a combo or listbox from
a datasource the second time has this giant pause.
First and third and all other subsequent fills go fine, it's only the
second one that has a delay.
On Monday, I'll try to build a super minisample using northwind or pubs
sample database and see if I can test and demonstrate the problem
without any of the other overhead I have in my app.
Thanks for your reply
Bob This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: vojtech |
last post by:
Hi,
I would like to remark on a problem described by Stephen Livesey
almost
3 years ago, about the slowdown he had experienced with an upload of
several
millions of rows.
http://www.geocrawler.com/mail/thread.php3?subject=%5BGENERAL%5D+Slowdown+problem+when+writing+1.7million+records&list=12
|
by: Bradley |
last post by:
Has anyone else noticed this problem? I converted the back-end to A2000
and the performance problem was fixed. We supply a 97 and 2000 version
of our software so we kept the backend in A97 to make upgrading simple
for users. We've done it like that for years but a new client has been
having severe performance issues... solved by converting the backend to
2000.
--
regards,
Bradley
|
by: Kevin Swanson |
last post by:
I'm writing what should be a very simple app against an Oracle database. The
app has a number of user controls, any one of which is loaded into a main
display page using the loadControl method, depending on which menu item a
user selects. Each of these controls follows the same basic pattern: Get a
dataset from the database and then display the results using basic
databinding.
Everything works fine except that I'll occaisionally get an...
|
by: John Bailey |
last post by:
When I first built a few web pages in ASP .Net 2.0, I thought it was great.
The formview and detailview contorls would automatically layout the controls
for you, the update methods were automatically generated, and the
objectdatasource let you design against a business object through the gui.
Now I am working on my first real web application on 2.0, and I find this
automatic functionality doesn't do much beyond allowing me to generate...
|
by: Nathan Sokalski |
last post by:
I have two databinding expressions (the first & last names from a DB) that I
want to assign to the text property of a Label so that the result is
LASTNAME,FIRSTNAME. At the moment, I have the following which I know works
when I use it by itself:
text='<%# DataBinder.Eval(Container,"DataItem.membernames.lname") %>'
What I need to do is somehow concatenate this databinding expression, a
comma, and another databinding expression for the...
| |
by: GaryDean |
last post by:
We have been noticing that questions on vs.2005/2.0 don't appear to get much
in answers so I'm reposting some questions posted by some of the programmers
here in our organization that never got answered...
In 1.1 we always did our own myDataAdapter.fills and we liked that control
for lots of good reasons. Now the new DataSource (or is it a
TableAdapter:Dataset) automatically fills the Gridview. How can we control
that fill?
In a...
|
by: Dirk |
last post by:
Hello,
I have a problem to use databinding with my business layer classes. My
data class does not have simple properties (string, int or datetime),
instead, all my properties are objects of the generic type Field<T>
(see sample code).
public class Employee
{
public Field<stringForename
|
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgS2lxdWVuZXQ=?= |
last post by:
Hello to all,
I want to know if DataBinding in asp.net 2,0 is better than to fill up the
values of the controls of the following form:
this.miControlTextBox.Text = valorParaControlTextbox;
Performance with databinding is good in asp.net 2.0 ? Would you prefer:
databinding or set value to Text property of control ?
|
by: guillaume weymeskirch |
last post by:
Hello everybody,
To test the python 2.5 garbage collector, I wrote a trivial script
allocating dummy objects of various sizes, then forgetting them in a loop.
The garbage collector seems working well, limiting the memory used.
But I've noticed a near linear slowdown of the execution : after a few
minutes - and several millions of allocated and freed objects, each
iteration take more and more time to execute.
|
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...
|
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,...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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...
|
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...
|
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...
|
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();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |