Board index » delphi » table does not support this operation because it is not uniquely indexed...

table does not support this operation because it is not uniquely indexed...

I have a Delphi 3 database application accessing a table on an SQL 6.5
server. To create a new record, I run a stored procedure consisting of an
INSERT statement, then call LAST on my dataset. This allows my IDENTITY
field to be generated and saves problems with that being null. My IDENTITY
field is also my PRIMARY KEY field and is, therefore, unique with a
clustered index. However, one day it has started giving the error "table
does not support this operation because it is not
uniquely indexed" when I attempt to create a new record from within Delphi.
The problem is when I call DATASET.REFRESH, which is the only way
I could get it to work properly. Closing then opening the dataset gives an
access violation.

Any ideas???

Cheers.

 

Re:table does not support this operation because it is not uniquely indexed...


Refresh only works on TTable's !
To get the same result use:

var
  B: TBookmark;
begin
  Query1.DisableControls;
  try
    B := Query1.GetBookmark;
    try
      Query1.Close;
      Query1.Open;
      Query1.GotoBookmark(B);
    finally
      Query1.FreeBookmark(B);
    end;
  finally
    Query1.EnableControls;
  end;
end;

"Philip Green" <wikidaba...@hotmail.com> schreef in bericht
news:8ct451$j8s$1@lure.pipex.net...

Quote
> I have a Delphi 3 database application accessing a table on an SQL 6.5
> server. To create a new record, I run a stored procedure consisting of an
> INSERT statement, then call LAST on my dataset. This allows my IDENTITY
> field to be generated and saves problems with that being null. My IDENTITY
> field is also my PRIMARY KEY field and is, therefore, unique with a
> clustered index. However, one day it has started giving the error "table
> does not support this operation because it is not
> uniquely indexed" when I attempt to create a new record from within
Delphi.
> The problem is when I call DATASET.REFRESH, which is the only way
> I could get it to work properly. Closing then opening the dataset gives an
> access violation.

> Any ideas???

> Cheers.

Other Threads