none
how change primary key type in tables of dataset afler read xsd file RRS feed

  • Question

  •  

    I want change primary key type in tables afler read xsd file in to dataset.

    this primary keys are create automatically aafter read xsd file

    I am try

     

    Code Snippet

    ds.ReadXmlSchema(fileNameXSD);

    DataColumn[] pdc = ds.Tables[0].PrimaryKey;

    pdc[0].DataType = System.Type.GetType("System.Guid");

     

     

    but last string generate exception System.Data.InvalidConstraintException: "Among parent columns and derived columns there are no columns of conterminous types"

     

     

    Wednesday, September 17, 2008 7:41 AM

All replies

  • Hi,

     

    By the exception thrown seems that you have a relation with another table and changing the key type don't match with the relation key (FK) type.

     

    Can you confirm the structure of your dataset? do you have relations between tables on your dataset? You should be able to change Primary Key type.

     

    Please let me know if this help you

     

    Best Regards

    Juan

    Wednesday, September 24, 2008 11:31 PM
    Moderator