[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.interop

C# How to add index PrimaryKey with DAO

Requena Claudio

9/24/2007 10:38:00 AM

Hi,

Iâ??m trying to add an Index PrimaryKey in one table with no success.
in the code below the Fields.Append don't exist and give me error.

DAO.TableDef OBJTable = DAO_DATABASE.TableDefs["Table"];
DAO.Index OBJIndex = OBJTable.CreateIndex("PrimaryKey");
OBJIndex.Fields.Append(OBJIndex.CreateField("fMonthCD"));

Any help will be appreciated, Thanks.


1 Answer

WillieD

10/18/2007 11:55:00 PM

0



"Requena Claudio" wrote:

> Hi,
>
> Iâ??m trying to add an Index PrimaryKey in one table with no success.
> in the code below the Fields.Append don't exist and give me error.
>
> DAO.TableDef OBJTable = DAO_DATABASE.TableDefs["Table"];
> DAO.Index OBJIndex = OBJTable.CreateIndex("PrimaryKey");
> OBJIndex.Fields.Append(OBJIndex.CreateField("fMonthCD"));
>
> Any help will be appreciated, Thanks.
>
>

I had the same problem. Try casting it to DAO.IndexFields:

DAO.Field idxFld = OBJIndex.CreateField("fMonthCD");
((DAO.IndexFields) OBJIndex.Fields).Append(idxFld);