Page 1 of 1

How can understand that a Field is AutoIncrement Field?

Posted: Wed 23 Mar 2005 16:32
by Murat
I have a table on MS SQL SERVER, and table has a autoincrement field that s name is 'ID'. I open with clientdaset this table, but i can not understand ID Field is AutoIncrement or not.

I must define Field is AutoIncrement because i do some job about field type automatically. How can i understand that a field is autoincrement or not?

Thanks.

Posted: Thu 24 Mar 2005 09:45
by Ikar
For autoinc fields Field.AutoGenerateValue = arAutoInc is set.

Posted: Thu 24 Mar 2005 14:02
by Guest
Ikar wrote:For autoinc fields Field.AutoGenerateValue = arAutoInc is set.
hi, I think i can not explain exactly what i mean.

Follow Steps

1. Create A Table
CREATE TABLE [dbo].[Table_Inc] (
[ID] [int] IDENTITY (1, 1) NOT NULL ,
[NAMA] [varchar] (50) COLLATE Turkish_CI_AS NULL
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[Table_Inc] WITH NOCHECK ADD
CONSTRAINT [PK_Table_Inc] PRIMARY KEY CLUSTERED
(
[ID]
) ON [PRIMARY]
GO

2.Create a Application
3.Drop a TSQLConnection, and connect to sql (with core dbexpress)
4.Drop TSQLQuery and set connection property
5.Drop TDatasetProvider, set DataSet property, set AllowCommandText True
6.Drop TClientDataSet, set providername property,
7. set Clientdataset CommandText as "SELECT * FROM Table_Inc"
8. set Active as True
9.Open Clientdataset Fieldeditor
10.Click Add All Fields

and when i look ID Field, ID Field's AutoGenerateValue property is arNone. And ID Field type is TIntegerField. Read Only property is false.

In normal, ID Field must be AutoIncField, and Reada only is true.

I want to learn this fields is auto increment or not?

Thanks

Murat Ak

Posted: Fri 25 Mar 2005 10:27
by Ikar
Sorry, it is my mistake. On using DbxSda it is impossible to retrieve information about AutoInc-fields.

Posted: Mon 17 Oct 2005 13:36
by 99Percent
Ikar wrote:Sorry, it is my mistake. On using DbxSda it is impossible to retrieve information about AutoInc-fields.
How do you use autoincrement fields with DbxSda? Do you have to manually specify the Field.AutoGenerateValue to arAutoInc?

Posted: Tue 18 Oct 2005 14:03
by Ikar
Due to dbExpress technology limitations we can't return isAutoIncrement flag for such fields.

Posted: Wed 02 Nov 2005 17:23
by 99Percent
I am trying to use the autoincrement feature of the column.

During an insert does your driver send a null value for this column when arAutoInc is specified and get the actual value from the server after the insert?

I can't get it to work this way. I specify arAutoInc at the TSQLDataSet.Field object do I need to specify it also at the ClientDataSet level?

Posted: Wed 02 Nov 2005 21:02
by 99Percent
Never mind I had forgotten to set the identity property at the table design on the server :oops: