I have a table named Permissions which is defined in a dataset named _permissionsSet and it has 3 columns: PermissionGroup, Permission, PermissionLevel (in that order)
I set the primary key on the table to include all 3 columns like this
DataColumn[] keys = new DataColumn[3];
keys[0] = _permissionsSet.Permissions.Columns[0];
keys[1] = _permissionsSet.Permissions.Columns[1];
keys[2] = _permissionsSet.Permissions.Columns[2];
_permissionsSet.Permissions.PrimaryKey = keys;
When I look at the values in "keys" they are as expected:
? keys
{System.Data.DataColumn[3]}
[0]: {PermissionGroup}
[1]: {Permission}
[2]: {PermissionLevel}
But when I look at the primary key the order has changed!
? _permissionsSet.Permissions.PrimaryKey
{System.Data.DataColumn[3]}
[0]: {PermissionGroup}
[1]: {PermissionLevel}
[2]: {Permission}
This has obvious implications when using the Rows.find method in my datatable.
Does anyone know why this is happening?