DataTable.PrimaryKey throws exception on an empty table

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • MuZZy

    #1

    DataTable.PrimaryKey throws exception on an empty table

    Hi,

    I wonder if anybody could help me here: i'm trying to set a primary key
    on a table

    DataTable dt = new DataTable;
    FillTable(dt);
    dt.PrimaryKey = myDataColumn;

    , and in case if the table is empty, i get an exception:
    "these columns do not currently have unique values".

    I think it's strange, as primary key is the table's property and exists
    regardless of contained data. Am i wrong here?

    Thank you
    Andrey
Working...