How using ADO Create a Table and Specify that a Field is autoNumber and Primary Key 
Author Message
 How using ADO Create a Table and Specify that a Field is autoNumber and Primary Key

Using ADO I am creating a Table everything works fine but I need to specify
that the first field "ID" its autoNumber and Primary Key

conn.Execute(Create Table Name(ID Number, Field1 varchar, Field2
varchar,....)

Thanks For any help



Mon, 14 Feb 2005 23:56:20 GMT  
 How using ADO Create a Table and Specify that a Field is autoNumber and Primary Key
Edwin

create table t1 (c1 counter primary key, c2 int, ...)

or

create table t1 (c1 int identity (1,1) primary key, c2 int, ...)

According to your db and your need, one of the above will do. With the
second, you can set the start number and the interval.

--
Han Pohwan, Seoul/Korea, Microsoft MVP


Quote:
> Using ADO I am creating a Table everything works fine but I need to
specify
> that the first field "ID" its autoNumber and Primary Key

> conn.Execute(Create Table Name(ID Number, Field1 varchar, Field2
> varchar,....)

> Thanks For any help



Tue, 15 Feb 2005 01:15:24 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Creating Tables with an Autonumber Primary key

2. Creating Tables with an Autonumber Primary key

3. Specifying field size when using CREATE TABLE

4. Creating Autonumber field using ADO

5. create table with autonumber field

6. Creating new fields in Access tables using ADO 2

7. How to create a table with Autonumber field?

8. Creating autonumber field to table

9. Create Table with Autonumber Field

10. Create Table (MS Access) with autonumber field

11. How do you create table with Autonumber field?

12. Access Autonumber fields in CREATE TABLE

 

 
Powered by phpBB® Forum Software