I'm writing a VB.Net program. At startup the program looks for a default
Access mdb and if it isn't there, creates it. At least that's the design.

My question is this: Using ADOX, is there anyway to declare an
AutoIncrement table field? I don't see anything in the DataTypeEnum that
seems equivalent.

Dim tbl As New Table
tbl.Name = "Table1"
tbl.Columns.Append("Field1", ??????? )

Re: Question about creating Access tables in VB.Net using ADOX by CT

CT
Fri Oct 28 02:14:29 CDT 2005

You need to use the DataTypeEnum.adInteger and then set the AutoIncrement
property;

Dim tbl As New Table
Dim col as New Column
tbl.Name = "Table1"
col.Name = "Field1"
col.Type = DataTypeEnum.adInteger
' Add column to the catalog
col.ParentCatalog = catalog ' Of type ADOX.Catalog
col.Properties("Autoincrement") = True
tbl.Columns.Append(col)



--
Carsten Thomsen
Communities - http://community.integratedsolutions.dk

"B. Chernick" <BChernick@discussions.microsoft.com> wrote in message
news:7265BC18-8D90-4013-8AC8-87F955A76E02@microsoft.com...
> I'm writing a VB.Net program. At startup the program looks for a default
> Access mdb and if it isn't there, creates it. At least that's the design.
>
> My question is this: Using ADOX, is there anyway to declare an
> AutoIncrement table field? I don't see anything in the DataTypeEnum that
> seems equivalent.
>
> Dim tbl As New Table
> tbl.Name = "Table1"
> tbl.Columns.Append("Field1", ??????? )



Re: Question about creating Access tables in VB.Net using ADOX by Cor

Cor
Fri Oct 28 02:17:29 CDT 2005

B,

You need only the adox part to cretate the table after that you can go to
the normal AdoNet commands.

Have a look at this sample.

http://www.vb-tips.com/default.aspx?ID=e76b8450-4c8a-4662-8f41-d6dda3c888c8

I hope this helps,

Cor



Re: Question about creating Access tables in VB.Net using ADOX by BChernick

BChernick
Fri Oct 28 08:38:02 CDT 2005

Thanks! That would have been my next step, if I couldn't get ADOX to
cooperate. I am not that used to creating DBs programmatically.

"Cor Ligthert [MVP]" wrote:

> B,
>
> You need only the adox part to cretate the table after that you can go to
> the normal AdoNet commands.
>
> Have a look at this sample.
>
> http://www.vb-tips.com/default.aspx?ID=e76b8450-4c8a-4662-8f41-d6dda3c888c8
>
> I hope this helps,
>
> Cor
>
>
>