How to flag dataset rows as new

C

cj

I am copying rows from a database/table on Server_A to a database/table
on Server_B. I use Server_A_DataAdapter.fill to load the rows into a
dataset. Then Server_B_DataAdapter.update to put the rows into the
database/table on Server_B. I then notice that the rows are not being
put on Server_B via the insert command of Server_B_DataAdapter because
the rows are not new to the dataset.

How can I flag the rows in the dataset as new?
Or is there a better way to accomplish this task?

Thanks
 
C

Cor Ligthert [MVP]

CJ,

By setting the acceptchangesafterfill property from the dataadapter to false

I hope this helps,

Cor
 
C

cj

I don't see acceptchangesafterfill in the help.
I see:
DataRow.AcceptChanges Method [Visual Basic]
Commits all the changes made to this row since the last time
AcceptChanges was called.

DataAdapter.AcceptChangesDuringFill Property [Visual Basic]
Gets or sets a value indicating whether AcceptChanges is called on a
DataRow after it is added to the DataTable during any of the Fill
operations.

How would I use acceptchanges.... in the below code.
MyOdbcAdapter.Fill(MyDs, "recent_calls")
SqlDataAdapter1.Update(MyDs, "recent_calls")
 
C

cj

They don't have any examples of how this is used but this seems to work.
Thanks for the help.

MyOdbcAdapter.AcceptChangesDuringFill = False
MyOdbcAdapter.Fill(MyDs, "recent_calls")
SqlDataAdapter1.Update(MyDs, "recent_calls")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top