Primary key

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a programmatic way to use VB code to set the Primary Key for a
table? This is for an ADP project accessing SQL Server tables. Access help
shows ADOX method but my system doesn't recognize ADOX.

Thanks,
 
What do you mean by "my system doesn't recognize ADOX"? Have you set
reference to "Miscrosoft ADO Extension 2.x for DDL and Security" library
(this is what ADOX refers to)?

To change database structure, you can either use ADOX, or just execute
"ALTER TABLE..." sql statement through ADODB.Connection/Command object.
 
you should just use the ALTER TABLE syntax



CREATE TABLE [dbo].[AddressBook](
[iPK_AddressBookID] [int] IDENTITY(1,1) NOT NULL,
[iTypeID] [tinyint] NULL,
CONSTRAINT [PK_Owners] PRIMARY KEY CLUSTERED
(
[iPK_AddressBookID] ASC
) ON [PRIMARY]
) ON [PRIMARY]
 
Back
Top