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 daabase application accessing a table on an SQL 6.5
server. To create a new record, I run a stored procedure 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
ginving 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 appears to be when I call DATASET.REFRESH, which is the only way
I could get it to work properly.

Any ideas???

Cheers.

 

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


With SQL Backends you must close and open the Dataset to refresh the result set
since the server side determines the result set.

Quote
Philip Green wrote:

> I have a Delphi 3 daabase application accessing a table on an SQL 6.5
> server. To create a new record, I run a stored procedure 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
> ginving 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 appears to be when I call DATASET.REFRESH, which is the only way
> I could get it to work properly.

> Any ideas???

> Cheers.

--
Jeff Overcash (TeamB)
      (Please do not email me directly unless  asked. Thank You)
Maybe it was infatuation or the thrill of the chase.
Maybe you were always beyond my reach and my heart was playing safe.
But was that love in your eye I saw or the reflection of mine?
Give me time, won't you give me that time!
Welcome back to the circus.            (Fish)

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


Cheers.

Jeff Overcash (TeamB) <overc...@onramp.net> wrote in message
news:38EF3F05.DC3E8C41@onramp.net...

Quote
> With SQL Backends you must close and open the Dataset to refresh the
result set
> since the server side determines the result set.

> Philip Green wrote:

> > I have a Delphi 3 daabase application accessing a table on an SQL 6.5
> > server. To create a new record, I run a stored procedure 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
> > ginving 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 appears to be when I call DATASET.REFRESH, which is the only
way
> > I could get it to work properly.

> > Any ideas???

> > Cheers.

> --
> Jeff Overcash (TeamB)
>       (Please do not email me directly unless  asked. Thank You)
> Maybe it was infatuation or the thrill of the chase.
> Maybe you were always beyond my reach and my heart was playing safe.
> But was that love in your eye I saw or the reflection of mine?
> Give me time, won't you give me that time!
> Welcome back to the circus.            (Fish)

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


I have tried closing and then reopening the dataset for each new record, but
I am getting access violations. Any idea why this may be?

Quote
Philip Green <ph...@coldseal.co.uk> wrote in message

news:8cnm48$8n89@bornews.borland.com...
Quote
> Cheers.

> Jeff Overcash (TeamB) <overc...@onramp.net> wrote in message
> news:38EF3F05.DC3E8C41@onramp.net...
> > With SQL Backends you must close and open the Dataset to refresh the
> result set
> > since the server side determines the result set.

> > Philip Green wrote:

> > > I have a Delphi 3 daabase application accessing a table on an SQL 6.5
> > > server. To create a new record, I run a stored procedure 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
> > > ginving 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 appears to be when I call DATASET.REFRESH, which is the
only
> way
> > > I could get it to work properly.

> > > Any ideas???

> > > Cheers.

> > --
> > Jeff Overcash (TeamB)
> >       (Please do not email me directly unless  asked. Thank You)
> > Maybe it was infatuation or the thrill of the chase.
> > Maybe you were always beyond my reach and my heart was playing safe.
> > But was that love in your eye I saw or the reflection of mine?
> > Give me time, won't you give me that time!
> > Welcome back to the circus.            (Fish)

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


No, I don't use SQL 6.5, but I'd suspect something in the driver.  Are you
explicitly preparing the query?

Quote
Philip Green wrote:

> I have tried closing and then reopening the dataset for each new record, but
> I am getting access violations. Any idea why this may be?

--
Jeff Overcash (TeamB)
      (Please do not email me directly unless  asked. Thank You)
Maybe it was infatuation or the thrill of the chase.
Maybe you were always beyond my reach and my heart was playing safe.
But was that love in your eye I saw or the reflection of mine?
Give me time, won't you give me that time!
Welcome back to the circus.            (Fish)

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


I'd suspect bug in your code, like remembering field pointers when dataset
has default fields:
KeyField := Dataset.FieldByname('Key');
Dataset.Close;
Dataset.Open;

if Dataset has default fields, they are recreated after open, so KeyField
variable is an invalid pointer.

--
----------------------
Regards
Robert Cerny
Remove both qwe when replying
email: robert.qwe.ce...@neosys.xrs.qwe.si

No questions via email, unless explicitly invited.

Quote
Philip Green wrote in message <8co751$e...@bornews.borland.com>...
>I have tried closing and then reopening the dataset for each new record,
but
>I am getting access violations. Any idea why this may be?

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


Is there any other way of doing this than calling Dataset.Close /
Dataset.Open?
It appears to be when I reopen the dataset that I get access violations.
I tried using RESYNC([rmExact]) instead of REFRESH, but that doesn't
actually do much. The strange thing is, I have a working executable that
just calls STOREDPROC.OPEN, DATASET.REFRESH, DATASET.LAST, STOREDPROC.CLOSE
that works fine, but I have since changed the code (in, as far as I can see,
unrelated areas) and that now gives the error about table indexes. This is
wierd!
Unfortunately I have other changes to make so I can't use the working
executable and my code is now altered!!

Jeff Overcash (TeamB) <overc...@onramp.net> wrote in message
news:38EF3F05.DC3E8C41@onramp.net...

Quote
> With SQL Backends you must close and open the Dataset to refresh the
result set
> since the server side determines the result set.

> Philip Green wrote:

> > I have a Delphi 3 daabase application accessing a table on an SQL 6.5
> > server. To create a new record, I run a stored procedure 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
> > ginving 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 appears to be when I call DATASET.REFRESH, which is the only
way
> > I could get it to work properly.

> > Any ideas???

> > Cheers.

> --
> Jeff Overcash (TeamB)
>       (Please do not email me directly unless  asked. Thank You)
> Maybe it was infatuation or the thrill of the chase.
> Maybe you were always beyond my reach and my heart was playing safe.
> But was that love in your eye I saw or the reflection of mine?
> Give me time, won't you give me that time!
> Welcome back to the circus.            (Fish)

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


Philip,

Are you using TTable or TQuery to access the database table?

Regards,
Richard

Other Threads