B
Brent
Hello,
I am about to start developing some code that will take a complex DataSet
and Copy it to a new DataSet. This new dataset must be recognized by our web
service as a completely new entity so any primary keys that are autonumbers
must be changed to negative numbers. I also need the rowstate for each row
in each table in the DataSet to equal DataRowState.Added so that the save
function on the web service treats every row in the DataSet as a new row.
Here's what I'm thinking:
- Copy the data structure only to the new DataSet with the MyDataSet.Clone()
method
- Loop through all the tables and rows and insert them into the new DataSet
- Because I'm adding rows to a new empty DataSet I'm hoping that the
DataRowState property is set to 'Added'
- Loop through all the newly created rows in the new DataSet and change all
primary keys to a negative number
If I send this dataset into my web service I'm hoping that it is recognized
as a completely new dataset so that all rows are inserted into the database.
Am I on the right track here or is there an easier way to do this.
Thanks,
Brent...
I am about to start developing some code that will take a complex DataSet
and Copy it to a new DataSet. This new dataset must be recognized by our web
service as a completely new entity so any primary keys that are autonumbers
must be changed to negative numbers. I also need the rowstate for each row
in each table in the DataSet to equal DataRowState.Added so that the save
function on the web service treats every row in the DataSet as a new row.
Here's what I'm thinking:
- Copy the data structure only to the new DataSet with the MyDataSet.Clone()
method
- Loop through all the tables and rows and insert them into the new DataSet
- Because I'm adding rows to a new empty DataSet I'm hoping that the
DataRowState property is set to 'Added'
- Loop through all the newly created rows in the new DataSet and change all
primary keys to a negative number
If I send this dataset into my web service I'm hoping that it is recognized
as a completely new dataset so that all rows are inserted into the database.
Am I on the right track here or is there an easier way to do this.
Thanks,
Brent...