Board index » delphi » Problem accessing MSSQL 7.0 table with TTable

Problem accessing MSSQL 7.0 table with TTable

I'm having a problem accessing a MSSQL 7.0 table with a TTable
component. The problem can also be reproduced with SQL Explorer.The
table I've created for test purposes is very simple: One field (which
is a key field) and three rows. Here's the SQL I used:

CREATE TABLE [jims].[mytable] (
 [name] [char] (20) NULL
) ON [PRIMARY]

CREATE UNIQUE
  INDEX [pri] ON [jims].[mytable] ([name])
ON [PRIMARY]

INSERT INTO [jims].[mytable] (name) VALUES ('aardvark')
INSERT INTO [jims].[mytable] (name) VALUES ('ADMIN')
INSERT INTO [jims].[mytable] (name) VALUES ('moose')

When the table is opened using SQL Explorer, the grid looks like this:

aardvark
ADMIN
moose

When I select the ADMIN record and try to put the table into edit mode,
a 'Record/Key Deleted' error is displayed. I can edit both the aardvark
and moose records. If I add an 'x' to the end of the aardvark record
and then click on the ADMIN record, the grid re-sorts to look like this
with the DB cursor set to the third line.:

ADMIN
aardvarkx
moose

I can now edit the ADMIN record. When the table is closed and reopened,
the sort order reverts back to the original and the ADMIN record can't
be edited.

This works OK for both Paradox database and an Oracle 8 database. I've
tried both the native MSSQL driver and ODBC.

Any ideas?

 

Re:Problem accessing MSSQL 7.0 table with TTable


In article <3884E2DF.2E565...@usa.net>,
  Jim Stonier <jston...@usa.net> wrote:

Quote
> I'm having a problem accessing a MSSQL 7.0 table with a TTable
> component. The problem can also be reproduced with SQL Explorer.The
> table I've created for test purposes is very simple: One field (which
> is a key field) and three rows. Here's the SQL I used:

> CREATE TABLE [jims].[mytable] (
>  [name] [char] (20) NULL
> ) ON [PRIMARY]

> CREATE UNIQUE
>   INDEX [pri] ON [jims].[mytable] ([name])
> ON [PRIMARY]

> INSERT INTO [jims].[mytable] (name) VALUES ('aardvark')
> INSERT INTO [jims].[mytable] (name) VALUES ('ADMIN')
> INSERT INTO [jims].[mytable] (name) VALUES ('moose')

> When the table is opened using SQL Explorer, the grid looks like this:

> aardvark
> ADMIN
> moose

> When I select the ADMIN record and try to put the table into edit
mode,
> a 'Record/Key Deleted' error is displayed. I can edit both the
aardvark
> and moose records. If I add an 'x' to the end of the aardvark record
> and then click on the ADMIN record, the grid re-sorts to look like
this
> with the DB cursor set to the third line.:

> ADMIN
> aardvarkx
> moose

> I can now edit the ADMIN record. When the table is closed and
reopened,
> the sort order reverts back to the original and the ADMIN record can't
> be edited.

> This works OK for both Paradox database and an Oracle 8 database. I've
> tried both the native MSSQL driver and ODBC.

> Any ideas?

Hi, Jim

I think that it's not a good idea to use TTable components with a
RDBMS. TTable is designed for local databases like DB or Paradox. Use
TQuery instead (RequestLive = True).
  Zoli

Sent via Deja.com http://www.deja.com/
Before you buy.

Re:Problem accessing MSSQL 7.0 table with TTable


When connecting to MSSS use ADO components (internal debugging turned off). Through TADOQuery, use a Resynch on afterpost, to get the "data-awareness" you're used to. Same behaviour (fly-away) using TADOTable is automatic (i think).

good luck

Quote
Jim Stonier wrote:
> I'm having a problem accessing a MSSQL 7.0 table with a TTable
> component. The problem can also be reproduced with SQL Explorer.The
> table I've created for test purposes is very simple: One field (which
> is a key field) and three rows. Here's the SQL I used:

> CREATE TABLE [jims].[mytable] (
>  [name] [char] (20) NULL
> ) ON [PRIMARY]

> CREATE UNIQUE
>   INDEX [pri] ON [jims].[mytable] ([name])
> ON [PRIMARY]

> INSERT INTO [jims].[mytable] (name) VALUES ('aardvark')
> INSERT INTO [jims].[mytable] (name) VALUES ('ADMIN')
> INSERT INTO [jims].[mytable] (name) VALUES ('moose')

> When the table is opened using SQL Explorer, the grid looks like this:

> aardvark
> ADMIN
> moose

> When I select the ADMIN record and try to put the table into edit mode,
> a 'Record/Key Deleted' error is displayed. I can edit both the aardvark
> and moose records. If I add an 'x' to the end of the aardvark record
> and then click on the ADMIN record, the grid re-sorts to look like this
> with the DB cursor set to the third line.:

> ADMIN
> aardvarkx
> moose

> I can now edit the ADMIN record. When the table is closed and reopened,
> the sort order reverts back to the original and the ADMIN record can't
> be edited.

> This works OK for both Paradox database and an Oracle 8 database. I've
> tried both the native MSSQL driver and ODBC.

> Any ideas?

Other Threads