A different "Error: Assign: Exception has been thrown by the target of an invocation"

Hi Community,

I have an error with “Assign: Exception has been thrown by the target of an invocation.” I understand that this topic has been shared quite a few times in other thread, I have checked it. it seems to be a different problem everytime.

So I’m going to place it here. Hope to have some help with this.

What it says in my code is “DTsheet3.PrimaryKey = new DataColumn() {DTsheet3.Columns(“StaffID”)}”

Thank you!

give a try on adding the data column first to the datatable and assign it afterwards to the primary keys set

Hi, i have the same problem.
im try add to datatable first and assign, still not working.
any idea ?
Thank you