Board index » delphi » help-teamB dbgrid not updating records?

help-teamB dbgrid not updating records?

 Hi, I know I have to be missing something obvious but I don't see it,
here is the problem: I have an interbase table with a primary key which
consists in two fields, I have a simple project with a TQuery whose SQL
stament is "select * from table", a DataSource, a DBNavigator and a
DBGrid, the DataSource connected to the query and of course the
DBNavigator and DBGrid connected to the DataSource. When I set the
Active property of the query to True I can see at design time the
table's data, when I run it and I try to post an new, inserted record
the new record replaces the one below it instead of being added at the
end of the grid! so I always see the same quantity of records in the
grid, however when I check the table with the SQL Explorer the records
were correctly inserted, of course I can insert the records normally
with the SQL Explorer.

  I have Delphi C/S 3.02.

  Thanks in advance.

  -Felipe.

 

Re:help-teamB dbgrid not updating records?


Hi Felipe

I'm not from TeamB but I'm trying to help.

I'll show a couple of possible solutions :
1-Use the follwing :

Query1.Open;
Query1.Last;
Form1.ActiveControl := DBGrid1;

and insert new records by hitting Key Down Arrow Key.

2-Insert new records using Append instead of Insert. Use the OnClick event
of the Navigator, as bellow :

procedure TForm1.DBNavigatorClick(Sender: TObject;
  Button: TNavigateBtn);
begin
if Button = nbInsert then Query1.Append;
end;

I hope it will help...

Elio Medeiros
Rio de Janeiro - Brasil
e-mail <el...@hotmail.com>

Re:help-teamB dbgrid not updating records?


Hi, I've got the same problem. If the current and last record appears in
the last row of DBGrid and I do DBGrid.DataSource.DataSet.Append the
last record will move down -- and out of sight.

Quote
Nois wrote:

> 2-Insert new records using Append instead of Insert. Use the OnClick event
> of the Navigator, as bellow :

As I said: append doesn't help here.

Werner

Other Threads