NYWGUY54
2010-03-04 17:35:01 UTC
I am trying to create a new Compact 3.5 database & tables in code so that my
user can create a new DB on the fly without my help. The problem is that I
cannot create 2 columns in the same table as a Primary Key pair this way.
When I define the table or alter it using the SQL Management Studio i can
make 2 columns the primary key. However in the SQLMS using a query i still
cannot alter the column to be a PK.
So am i doing something wrong, Is this a limitation of the Compact Engine?
My code for createing the table is:
"Create Table Settings " & _
"(Code nvarchar(50) Primary Key Not Null, " & _
"Type nvarchar(50) Primary Key Not Null) "
The error that is produced is "cannot parse query"
When i use the alter table method:
alter table settings add constraint [setPK] Primary key (Type)
The error says that the table already has a Primary Key.
Thanks
user can create a new DB on the fly without my help. The problem is that I
cannot create 2 columns in the same table as a Primary Key pair this way.
When I define the table or alter it using the SQL Management Studio i can
make 2 columns the primary key. However in the SQLMS using a query i still
cannot alter the column to be a PK.
So am i doing something wrong, Is this a limitation of the Compact Engine?
My code for createing the table is:
"Create Table Settings " & _
"(Code nvarchar(50) Primary Key Not Null, " & _
"Type nvarchar(50) Primary Key Not Null) "
The error that is produced is "cannot parse query"
When i use the alter table method:
alter table settings add constraint [setPK] Primary key (Type)
The error says that the table already has a Primary Key.
Thanks