• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 426
  • Last Modified:

Progressbar while opening DB

I want to putt ProgressBar while opening a DB.        
How to make progressar move then opening Form8 with dbgrid
database size about 20 MB
0
selas
Asked:
selas
  • 5
  • 3
1 Solution
 
mokuleCommented:
You should not use dbgrid with such an amount of information.
It makes no sens for any user.
You should use query to select needed information.
0
 
selasAuthor Commented:
And then how to show it?
0
 
ThoseBugCommented:
-- how to show it?

you can use a TADOCOnnection component (ADO pallete) to create the conecttion with your database...then you can use a TADOQuery (conecction = TADOCOnnection) and write some query like this... 'select * from my_table' then add a datasource (Dataset = TADOQUery) and dbgrid ...that's it...
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
selasAuthor Commented:
I do the same :/
But how to show progressbar (moving)
then getting about 20 Mb of information?
0
 
ThoseBugCommented:
1. you must set CursorLocation = clUseClient for your TADOQuery
2. you must set CursorType = ctStatic
3. you must include the eoAsyncFetchNonBlocking flag in ExecuteOptions
property
4. write next code in OnFetchProgress event:
procedure TForm1.ADOQuery1FetchProgress(DataSet: TCustomADODataSet;
  Progress, MaxProgress: Integer; var EventStatus: TEventStatus);
begin
  Progressbar1.Max := MaxProgress;
  Progressbar1.Position := Progress;
end
0
 
selasAuthor Commented:
maybe there is other way?
because in this way progress bar moves only in the end and very fast
0
 
selasAuthor Commented:
How to move progressbar in splashscreen?
then opening form with DbGrid?
0
 
ThoseBugCommented:
procedure TForm1.FormCreate(Sender: TObject);
begin
  Try
    DataBase1.Connected:=True
  Except
    ShowMessage('Cannot open DB1')
  end;
  SplashForm.ProgressBar.StepIt;
  SplashForm.update;
  Try
    DataBase2.Connected:=True
  Except
    ShowMessage('Cannot open DB2')
  end;
  SplashForm.ProgressBar.StepIt;
  SplashForm.update;
  Try
    Table1.Active:=True
  Except
    ShowMessage('Cannot open Table 1')
  end;
  SplashForm.ProgressBar.StepIt;
  SplashForm.update;
  Try
    Table2.Connected:=True
  Except
    ShowMessage('Cannot open Table 2')
  end;
  SplashForm.ProgressBar.StepIt;
  SplashForm.update;
  ...
  SplashForm.Free
0
 
selasAuthor Commented:
If i use fetch process it work, but not good
then i use this query: Select '* from klientai order by id
it moves ok!

but if i use: Select id, slapyvardis, lankomumas, zaidzia, sum(inesta), sum(atiduota), sum(balansas), (sum(inesta) * 0.005 + sum(atiduota) * 0.0025) as bonusai, laikas, ivede, krupje from esantys where laikas > '+QuotedStr(DateToStr(Now()))+' group by id order by laikas desc

it moves only on last of ten second

How to solve it?
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now