Add Multiple DataColumn as Parameter

Hi Everybody,

I’m looking for a solution in order to add Multiple Column as Primary Key to my DataTable.

Here is my issue. My assign is like :
dt1.PrimaryKey = New DataColumn() {dt1.Columns(“ID”),dt1.Columns(“ID2”)}

I’m trying to made it generic, so I will be able to give in parameter more Column.
I have tried several things, as List, Array, Collection, but Nothing seems to fit.

Any idea ?

Thank you for your help.

JF

Dim table As New DataTable()

    table.Columns.Add(New DataColumn("MyColumn"))

    Dim primaryKey(1) As DataColumn
    primaryKey(1) = table.Columns("MyColumn")
    table.PrimaryKey = primaryKey

so you can add as many as you like but need to get the count before creating the array…