Dataset refill issue - Stalls for 30 to 40 seconds

J

J. Clay

I have a typed dataset with three tables, one master and to child. This is
a contact management app, so I pull all of an organization contacts and
associated details into the set. (Anywhere from 1 to 100 contacts and their
associated detail). My form is bound to the dataset using VS2003 form
designer.

When I want to go to a contact in a different organization, I am trying to
do the following:

1) Clear the dataset using dataset.clear(0)
2) Refill The dataset with the new organization info using the original
adapters with the single paramete changed.
3) Use the CurrencyManager to find and set as current the specific contact I
am going to

This works fine except one MAJOR issue - I can fill the original set and go
to the contact fine. But, as soon as I try and change contacts, it hangs
for about 30 to 40 seconds before continuing on. After this first change,
it works great, with no delay. It is just in the FIRST clear and refill
that causes this issue.

I have tracked it down to specifically the Master table, but clearing each
table individually. I have even gone as far as to delete each row of the
master table individually, and it appears that it is hanging on the current
row. I have tried using SuspendBinding and ResumeBinding, but this did not
help.

If anyone has some ideas, I would greately appreciate it.

TIA,
Jim
 
C

Cor Ligthert

Jay,

Are you sure that it is 30 to 40 seconds. I have seen as well that fore some
handling in ADONET is unfortunaly used the exception handling. What gives in
some occasions strange behaviour. However 30 to 40 seems for me very much.
It can be of course that you use a not very fast computer.

The effect you describe is typicall for exception handling.

This means not directly that you have errors. You can test it by using in
the debugger by setting the radiobutton for "when the exception is thrown"
to "break into the debugger". (after that you selected the section that you
are testing in the treeview above that).

(And don't forget to set it back afterwards, there are more parts in .Net
where this is used however than you will not be notice it. When you use
VBNet than you can see that it is by instance used in the function "IsDate",
however than the effect is almost invisible.)

I hope this gives some idea's

Cor
 
J

J. Clay

It is right at 40 seconds. And it is ONLY the FIRST time I clear and refill
the dataset. All subsequent times, I very fast. The computer should be
plenty fast. It's a 2.8Ghz w/1Gb Ram machine, and 80gb of harddrive, so I
don't think that's the issue.

Thanks for the tip on the debugger, It did NOT throw any exceptions at the
spot that is hanging, but I found a couple of other minor things I can deal
with later.

Any more suggestions???

Thanks,
Jim
 
K

Kevin Yu [MSFT]

Hi Jim,

There is a known issue that if you bind a CombBox to a DataTable or
DataSet, when refilling the data source, the filling process will hang. You
can try to set the DataSource property of the controls on the form to null
before re-filling. And set them back after filling to see if it can resolve
this issue.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
J

J. Clay

The one bound combo box is already unbound before trying to clear the combo
box. Another part of the puzzle is that I am using Duncan Mackenzie's
DataBound Tree Control. I HAVE tried unbinding it prior to clearing the
dataset, but that hasn't help either. Today, I am going to set up a form
only with text boxes and see what happens when I try to clear and refill the
dataset.

I have narrowed it down to the specific record in the main table that the
form is on is the one that is hanging. I determined this by deleting each
row individually rather that clearing the entire table. In stepping through
the code, every row was removed instantly except for the row that had
binding to it on the form.

The strangest part about this is that it only happens the first time I try
to clear the dataset. All subsequent times have no delay.

Thanks,
Jim
 
J

J. Clay

After doing a bunch more testing, this is what I have found.

It is related to the combo box (I thought I had this dealt with). Here is
my code:

Private Sub FillContactDataSet(ByVal ContactID As Int32)
Try
Me.cmbAddress.DataSource = Nothing
Me.cmbAddress.DisplayMember = Nothing
Me.cmbAddress.ValueMember = Nothing
Me.dvAddress = Nothing

Me.ContactInfo1.Address.Clear()
Me.ContactInfo1.ContactDetails.Clear()
Me.ContactInfo1.ContactOrganizations.Clear()


Me.dadContactOrganizations.SelectCommand.Parameters("@ContactID").Value =
ContactID
Me.dadContactOrganizations.Fill(ContactInfo1.ContactOrganizations)

Me.dadContactDetails.SelectCommand.Parameters("@ContactID").Value =
ContactID
Me.dadContactDetails.Fill(ContactInfo1.ContactDetails)

Me.dadAddress.SelectCommand.Parameters("@ContactID").Value =
ContactID
Me.dadAddress.Fill(ContactInfo1.Address)

Me.dvAddress = ContactInfo1.Address.DefaultView
Me.cmbAddress.ValueMember = "AddressID"
Me.cmbAddress.DisplayMember = "AddressType"
Me.cmbAddress.DataSource = Me.dvAddress

Catch e As System.Exception
MessageBox.Show(String.Format("Error: {0}", e.Message), "LCP CRM",
MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub

I am clearing out the combo box and the dataview completely before clearing
and refilling the Dataset. Am I missing something?

Thanks,
Jim
 
K

Kevin Yu [MSFT]

Hi J. Clay,

Is there any other controls that are binding to
Me.ContactInfo1.ContactOrganizations? Also, how many rows are there in this
table?

If you could send me a simple example to reproduce this problem, it would
be helpful for me to deliver my assistance more quickly. Removing 'online'
from the nospam alias is my real email. Thanks!

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
S

Steven Cheng[MSFT]

Hi Jim,

Since kevin has been ill these days, we'll ask him to update you as soon as
he come back.
Thanks for your understanding.

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
K

Kevin Yu [MSFT]

Sorry, Jim. I got a high fever last week.

I checked my mailbox, you mail was received. However, the attachment was
deleted by our mail server. Could you try to put the files into a zip
package to make sure that it won't be deleted?

If you can attach the database together with your project, it would be more
helpful. Thanks!

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
J

J. Clay

Kevin,

I have had to pull back from this project for a week or so. When I get a
chance, I will send info.

Thanks,
Jim
 
K

Kevin Yu [MSFT]

Hi Jim,

No problem. When you send me project, please also reply to this post.
Thanks!

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top