The error is gone if I write create datatable at the very start of code : Dim dtOrig As DataTable = New DataTable()
But there is another problem. I want to copy a filled datatable to this newly created datatable. The filled datatable is dt_tempSql and it has same column names. I do not know, how to specify arguments in this case? I want to insert dtOrig into sql server afterwards.