473,408 Members | 1,966 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

my program locks up on DB queries....

hey, I run long queries. like once that take my program about 3 minutes
straight to complete.. like I grab over 100,000 rows, and loop throguh each
row to update a certain value. etc..

the program freezes when all this calculation is going on, so I thought I'd
put a progress bar. I even made it on a separate thread and used the callback
/ delegate stuff to make it show.

so here's how the method goes:
private void btnDoDatabasestuff_Click(object sender, EventArgs e)
{
Thread thProgbar = new Thread(new ParameterizedThreadStart(ShowProgBar));
thProgbar.Start("show");

//Lots of code here to do stuff

Thread thProgbar = new Thread(new ParameterizedThreadStart(ShowProgBar));
thProgbar.Start("hide");
}

the problem is that it STILL locks up. the only difference this time is it
locks up with a progress bar on the screen. it's an animated progress bar and
it still stops moving.

is there any other stuff I should be doing?

thanks.,
Sep 16 '08 #1
1 1172
On Sep 16, 3:53*pm, Rogelio <Roge...@discussions.microsoft.comwrote:
hey, I run long queries. like once that take my program about 3 minutes
straight to complete.. like I grab over 100,000 rows, and loop throguh each
row to update a certain value. etc..

the program freezes when all this calculation is going on, so I thought I'd
put a progress bar. I even made it on a separate thread and used the callback
/ delegate stuff to make it show.

so here's how the method goes:

private void btnDoDatabasestuff_Click(object sender, EventArgs e)
{
Thread thProgbar = new Thread(new ParameterizedThreadStart(ShowProgBar));
thProgbar.Start("show");

//Lots of code here to do stuff

Thread thProgbar = new Thread(new ParameterizedThreadStart(ShowProgBar));
thProgbar.Start("hide");

}

the problem is that it STILL locks up. the only difference this time is it
locks up with a progress bar on the screen. it's an animated progress barand
it still stops moving.

is there any other stuff I should be doing?
It sounds like you're still doing the database stuff in the UI thread,
which is the problem. Have a look at BackgroundWorker, which is
designed for this kind of situation.

Jon
Sep 16 '08 #2

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

Similar topics

4
by: Aaron Baugher | last post by:
I have an OpenBSD 3.3 system running MySQL 3.23.55 from the ports tree. Everything started out at the default settings. This system holds a large vBulletin 2.2.9 forum database, and that's pretty...
0
by: Leif Neland | last post by:
I'm logging mail to a database, and using php to make queries. The mail is coming in constantly, so the table is being added to, in batches of up to 30 mails. I have around 600k records. The...
17
by: Dr NoName | last post by:
Help! I have a table that multiple processes must be able to write to concurrently. However, it for some reason gets locked in exclusive mode. I narrowed it down to one SQL statement + some...
1
by: Sergio | last post by:
Hi all! I have a data .mdb file (in Access 2000 format) that's being used by two applications. These applications are built with Access 2K and all this runs under Windows 2000. Each application...
8
by: Noni Ledford | last post by:
Hi - I have a database on a network, and each user logins using a shortcut from his PC to the shared database. There is a table created by a make-table query that locks up whenever more than one...
1
by: Willard Farwark | last post by:
Does this mean that only one of the two offending SQL statements finished? The other did not? 2006-10-04-22.16.02.828568 Instance:xrprod Node:000 PID:11482(db2agent (CLINK_P)) ...
7
by: praveen | last post by:
Hi When does DB2 go for an IS (Intent Share) lock? IS mode is defined as a mode in which "The lock owner can read data in the locked table, but cannot update this data. Other applications can...
6
by: jsacrey | last post by:
Hello everybody, I've got a bit of a situation that I could use some guidance with if possible. I work for an auditing firm where my users audit electronic shipping data for customers to see if...
0
by: Ty | last post by:
I'm trying to google information about MS Access and why MS Access causes database locks within DB2. The Developers at my current job discourage MS Access queries on the DB2 database. Here is...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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,...

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.