Replace datatable to existing datatable

Hi,

Perhaps you should use not index but TableName as the following.

dt1.TableName="table1"
ds.Add(dt1)

Then

dt2.TableName="table1"
ds.Remove("table1")
ds.Add(dt2)

Please access the datatable with table name.

Regards,