Board index » delphi » Dataset.refresh doesn't work

Dataset.refresh doesn't work

After inserting a new record I want to refresh the dataset. But I get the
following error message:

Table has no unique index

But it has an unique index. Whats wrong ?

BTW: I'm using Delphi 4 and Interbase 5

regards
 Roger

 

Re:Dataset.refresh doesn't work


Roger,

The Refresh method does not work against SQL databases with the BDE.
Your recourse is to GetBookmark/Close/Open/GotoBookMark/FreeBookMark.

HTH - Mike

Quote
Roger Gilliar wrote:

> After inserting a new record I want to refresh the dataset. But I get the
> following error message:

> Table has no unique index

> But it has an unique index. Whats wrong ?

> BTW: I'm using Delphi 4 and Interbase 5

> regards
>  Roger

Re:Dataset.refresh doesn't work


The Refresh method is working with Interbase. I am using it.
But you can't use it with TQuery's . Only with TTables.

On Mon, 17 Aug 1998 11:54:51 +0200, "Roger Gilliar"

Quote
<rgill...@wwwdesign.de> wrote:
>After inserting a new record I want to refresh the dataset. But I get the
>following error message:

>Table has no unique index

>But it has an unique index. Whats wrong ?

>BTW: I'm using Delphi 4 and Interbase 5

>regards
> Roger

Re:Dataset.refresh doesn't work


Or if your records have unique keys, then Close/Open/Locate. The same
way
if you add record by the means of a stored proc:

create table SomeTable( ID integer not null, AAA char( 64 ), primary
key( ID ));

create generator SomeTableIDGenerator;

set term !! ;

create trigger SomeTableBeforeInsert
for SomeTable before insert
as
begin
 new.ID = Gen_ID( SomeTableIDGenerator, 1 );
end !!

create procedure SomeTableInsert( A char( 64 ))
 returns( N integer )
as
begin
 insert into SomeTable( AAA ) values( :A );
 select Max( ID ) from AAA into :N;
end !!

set term ; !!
commit;

in Delphi code

var
 VKey : variant;

begin
 Database.StartTransaction;
 try
  StoredProc.ExecProc;
 except
  Rollback;
  Exit;
 end;{try}
 Commit;
 with SomeTableQuery do
 begin
  DisableControls;
  Close;
  Open;
  Locate( 'ID', VKey, []);
  EnableControls;
 end;{with}
end;{}

Quote
Michael Mount wrote:

> Roger,

> The Refresh method does not work against SQL databases with the BDE.
> Your recourse is to GetBookmark/Close/Open/GotoBookMark/FreeBookMark.

> HTH - Mike

Other Threads