How can I Show progress bar when i am opening my clientdataset;
Say i am opening customers table and it contain ten hundred thousands of
records and i want to open them all at a time for loading into memory
dataset so what happens is ; which i say open to that clientdataset so first
it opens and nothing happens sometimes i think as if my machine is hang but
after sometime this process of loading into memory dataset starts. So is
there some way that i can show a progress bar when it is opening tat query
into that clientdataset.
Also I am looking for a procedure which I can use it in common for executing
SQLQueries;
Now presently I do the following way for all queries ;
cdsUpdate := TClientDataSet.Create(nil);
try
cdsUpdate.RemoteServer := RemoteConnection;
cdsUpdate.ProviderName := 'dspUpdate';
with cdsUpdate do begin
Close;
Params.Clear;
Params.CreateParam(ftString, 'pHeatName', ptInput);
Params.CreateParam(ftString, 'pRace_ID', ptInput);
CommandText := 'Update Race Set Heat_Name =:pHeatName Where
Race_ID=:pRace_ID';
Params.ParamByName('pHeatName').AsString := 'abc';
Params.ParamByName('pRace_ID').AsInteger := 123;
try
cdsUpdate.Execute;
except
on E: Exception do FireException(E.Message);
end;
Params.Clear;
Close;
end;
finally
cdsUpdate.Free;
end;
So does anyone have some kind of following :
RunQuery([ftString, ftString], ['pHeatName', 'pRace_ID'], ['abc', 123]);
So in above query I will pass all parameters of ftTypes, and the params to
create and their respective values and this query will run in a separate
thread.
Thanks,
Regards,
Anil Jagtap.
--
Bill (TeamB)
(TeamB cannot respond to questions received via email)
Well this loading of all records i will be doing only once on the start of
application later everything i keep in Memory Dataset, so eben though if it
takes 5 minutes for loading no problem but later overall in my application i
have a good speed with my customers and i just add one records to this
memory dataset when a new customer is added alongwith my database.
But as you said there has to be a better way to accomplish this, so can you
also suggest me like how can i do this.
Thanks,
Regards,
Anil Jagtap
"Bill Todd" <bi...@notthis.dbginc.com> wrote in message
news:mv6j8vg6cb8ii8ja3...@4ax.com...
Normal client/server design is to show the user a blank form when the
application starts and require the user to enter selection criteria to
fetch a small number of records to work with. After the user is done
with that batch of records and you have called ApplyUpdates(0) the
user enters new selection criteria and gets the next batch of records
from the database server.
So what can i do to this...
Thankyou very much... Waiting for your reply asap..
Regards,
Anil Jagtap.
"Bill Todd" <bi...@notthis.dbginc.com> wrote in message
news:hgsl8vo00flq3av9k...@4ax.com...
Drop an Animation control on the form and activate it until the load is
done.
--
Wayne Niddery - Logic Fundamentals, Inc. (www.logicfundamentals.com)
"Democracy, without that guarantee of liberty, is merely a method of
selecting tyrants." - Alan Nitikman
But that's entertainment, not progress.<g>
BookingCDS.PacketRecords:=100;
BookingCDS.Open;
While (BookingCDS.GetNextPacket<>0) And Not CancelQuery Do
Begin
ProgressLabel.Caption:=IntToStr(BookingCDS.RecordCount);
Application.ProcessMessages;
End;
Dan
"Anil Jagtap" <aja...@hitech-outsourcing.com> wrote in message
news:3e8c...@newsgroups.borland.com...
I do the following;
procedure LoadMembers(const ShowProgressWhere: String = '');
var cdsCust: TClientDataSet;
begin
Screen.Cursor := crHourGlass;
with dmSMS.cdsMemCust do begin // dmSMS.cdsMemCust is a memory
dataset - TkbmMemTable //
Close;
MasterSource := nil;
with dmSMS.cdsMemCust.FieldDefs do begin
Clear;
Add('ID', ftInteger, 0, False);
end;
end;
cdsCust := TClientDataSet.Create(nil);
cdsCust.RemoteServer := frmMainForm.DCOMConnection1;
cdsCust.ProviderName := 'dspBlank';
try
cdsCust.CommandText := ' Select Cust_ID, Prod_ID, Cust_Title,
'+
' F_ProperCase(Cust_NickName) Cust_NickName,
'+
' F_ProperCase(Cust_FirstName) Cust_FirstName,
'+
' F_ProperCase(Cust_LastName) Cust_LastName,
'+
' Cust_Phone, Cust_Fax, Cust_Mobile, Cust_Email,
'+
' Cust_Class, Card_Number, Card_Expiry,
Rec_Status, '+
' Cust_PhotoPath From Customer Where Cust_Class
<> 0 '+
' and Rec_Status = ''N''
';
cdsCust.Open;
try
dmSMS.cdsMemCust.LoadFromDataSet(cdsCust, [mtcpoStructure]);
finally
cdsCust.Close;
cdsCust.Params.Clear;
end;
finally
Screen.Cursor := crArrow;
cdsCust.Free;
end;
end;
So in this case when i say cdsCust.Open then he waits there till it is
opened in cdsCust's memory, and then after this it works in few span of
msecs, so where i have to write what you specified ;
Thanks again,
Regards,
Anil Jagtap.
------------------------------
"Dan Palley" <d...@trams.com> wrote in message
news:3e8dc929$1...@newsgroups.borland.com...
Use TProgressBar to add a progress bar to a form.
Progress bars provide users with visual feedback about
the progress of a procedure within an application. As
the procedure progresses, the rectangular progress bar
gradually fills from left to right with the system
highlight color.
=====
Ideally, one knows approximately the total number of rows one is about
to fetch, and for each iteration of the loop that's doing the fetching
one can increase the ProgressBar's position, or use its "StepIt" method.
TProgressBar is a better visual representation of progress than
animation, a spinning cursor, or even progresslabel.caption :=
IntToStr(recordcount). Perhaps it's even more entertaining :-)
Linda
Well I dont think this shall be that because I wanna show my progress bar
while i am opening my clientdataset and the no of records i will get when it
is opened, so after that its of no use... bcos as u said to get the nr of
records and using step it, so that is later stage when i am transferring
those records in my memory dataset.
Anyway, Thanks,
Anil.
"Linda Murphy" <koto...@juno.com> wrote in message
news:3e9b...@newsgroups.borland.com...
select count(*) as TOTAL_RECORDS from TABLE1 T1 where T1.FIELD1 = 'XYZ';
You can then set the progressbar max value....
HTH
Will
"Anil Jagtap" <aja...@hitech-outsourcing.com> wrote in message
The user wont have a clue what the difference is
"Anil Jagtap" <aja...@hitech-outsourcing.com> wrote in message
news:3e89...@newsgroups.borland.com...
Educate the user. Revisit the analysis of what he is doing, why he is doing
it, what needs to be achieved, there has to be a better alternative.
--
-Dave Rowntree