G
Guest
Hi,
I understand you must first remove the constraint. The following bit does
not work (where t is a DataTable). It gives a 'reference not set to an
object' error
t.PrimaryKey.Clear(t.PrimaryKey, 0, 1)
If t.Columns.Contains("MYKEY") Then
If t.Columns.CanRemove(t.Columns("MYKEY")) Then
t.Columns.Remove("MYKEY")
End If
End If
I understand you must first remove the constraint. The following bit does
not work (where t is a DataTable). It gives a 'reference not set to an
object' error
t.PrimaryKey.Clear(t.PrimaryKey, 0, 1)
If t.Columns.Contains("MYKEY") Then
If t.Columns.CanRemove(t.Columns("MYKEY")) Then
t.Columns.Remove("MYKEY")
End If
End If