Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9025817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T06:22:10+00:00 2026-06-16T06:22:10+00:00

I have a large query that needs to be loaded into memory. This query

  • 0

I have a large query that needs to be loaded into memory. This query takes about 30 seconds to open. It loads immediately after the application starts, only once. During this time the application hangs. What I need to do is to update a progress bar, during the 30 seconds. I’ve tried to create a new thread to update the progress bar, but it will only update after the query is opened. Can anyone point a simple way to do this?

I’ve created a thread class:

type
   TMyThread = class(TThread)
   private
      fLowerLimit: Integer;
      fUpperLimit: Integer;

I’m creating an instance of the thread class:

   CountingThread := TMyThread.Create(0, 300, True);
   CountingThread.Resume;
   //
   SplashDlg.Show;

Inside the thread I’m just updating the progress bar:

procedure TMyThread.UpdateMainThread;
begin
   SplashDlg.ProgressBar1.Position:= SplashDlg.ProgressBar1.Position+1;
   MyDebug('UpdateMainThread:'+ IntToStr(SplashDlg.ProgressBar1.Position));
end;

The thread hangs while the query is opening.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T06:22:12+00:00Added an answer on June 16, 2026 at 6:22 am

    You’re doing it the other way around.

    The UI is bound to the application main thread, so you always take care of the UI in the main thread, and do the real job in a worker thread (from there the worker name).

    The way you’re asking the question, you’re already dealing with threads, so, just change your point of view and perform the heavy SQL load in a secondary thread while keeping your UI responsive and updated in the, now non-busy, main thread.

    As for the 30 seconds wait time, really, if you can’t determine exactly the load time is better to not use a progress bar, since we all hate that liar bars who don’t reflect the real state of things. Your bar sometimes will show 50% and suddenly goes to 100%… or it may reach 100% while in fact the real thing is going to take ages to complete (heavy load on the server, slow network, and 1,000 other factors).

    Nowadays, we all are used to the just wait indicators, like this:

    enter image description here

    enter image description here

    enter image description here

    When you see this, you know it is working, and you just have to wait until it completes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is the issue I am having: I have a large query that needs
We have a query that runs off a fairly large table that unfortunately needs
What I have is an extremely large text file that needs to go into
Let's say I have a large query (for the purposes of this exercise say
I have a class that needs a property set inside a LINQ-to-SQL query. My
I have an app that needs to update a large amount of data over
I have an app that needs to handle very large strings between a SQL
I have a remote sql connection in C# that needs to execute a query
I'm trying to create a faster query, right now i have large databases. My
I have a large amount of data to sort and query, and I can't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.