Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

table refresh

Status
Not open for further replies.

filipe26

Programmer
Mar 17, 2003
152
PT
i have both pc's with the same shared BDE database,but i have a problem.It seems that the refresh button on the Tnavigator doesn't work.the tables are not refreshing when i append new records unless i close and open the table but when i do that obviously goes to the first record.Why refresh button doesn't work??
 
I'm assuming a desktop db (like Paradox or xBase). Do you have the BDE set up on both with LOCALSHARE set to True? If not, the BDE will buffer the data and not actually write it to the disk until either the buffer is full or the table is closed.

If you don't want to have to configure the BDE, there is another technique you can use.

1. Add dbiProcs to your uses clause.
2. In the AfterPost and AfterDelete event handlers, put the following code:
dbiSaveChanges(MyTable.handle);

(of course, substituting your TTable name for "MyTable".)

-D
 
Doesn't seem to work.On pc that has the db files i have a directory called Netdir and i have on host datamodulecreate event the following code:

procedure Tdm.DataModuleCreate(Sender: TObject);
var
sPrvDir:String;
begin
// Fazendo Login
try
MyDatabase.Close;
sPrvDir:='C:\WINDOWS\TEMP\PRV\'+ExtractFileName(ParamStr(0))+'\';
if not DirectoryExists(sPrvDir) then ForceDirectories(sPrvDir);
MyDatabase.Directory:=sPrvDir;
MyDatabase.Session.NetFileDir:='F:\Netdir';
MyDatabase.Session.PrivateDir:=sPrvDir;
MyDatabase.Session.SessionName:='Default';
MyDatabase.Params.Values['PATH']:='F:\';
MyDatabase.Params.Values['DEFAULT DRIVER']:='PARADOX';
MyDatabase.Params.Values['ENABLE BCD']:='TRUE';
MyDatabase.Open;
except
on e:exception do
begin
Application.MessageBox(Pchar(e.message),'Erro na conecção!',MB_ICONERROR);
end;
end;


end;

After i append like you said on refresh button of the TNavidator on both pc's the code:

dbisavechanges(dm.clientes.Handle);

where clientes is a Ttable.

On the server(pc where i have the tables) i dont have the Tdatabase component,just the tables with the property database name linked to the Alias.

Thanks for help.
 
dbiSaveChanges goes in the AfterPost or AfterDelete of the TTable, not in the Refresh.

Your code looks ok in terms of setting various BDE stuff. However, I don't think you can set LOCALSHARE in code, it has to be done through the BDE Administrator - on the Configuration tab, go to System|Init and set LOCALSHARE to True. This will cover ALL aliases that are defined.

Also, in order to see what the other user has edited, you WILL have to refresh the table - you don't automatically see it.

-D

 
yes i have local share on host pc set to true and i have also dbisavechanges.. on afterpost/afterdelete event and when i refresh the table on both sides i dont see the new records,only if i close and open the table.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top