ImportRow requires AcceptChanges

  • Thread starter Thread starter Ben Hunsberger
  • Start date Start date
B

Ben Hunsberger

I have two datasets

ds1, ds2 as mytypedds

I programmatically make a change to a row in ds1

row = ds1.tbl1(0)
row.qty = 5

I then import this row to ds2

ds2.clear()
ds2.tbl1.importrow(row)
row2 = ds2.tbl1(0)

Strangly enough row2.qty = 0, unless I preceed with row.acceptchanges.

What gives?
 
Hi, this is what docs say about ImportRow:

"Calling NewRow adds a row to the table using the existing table schema, but
with default values for the row, and sets the DataRowState to Added. Calling
ImportRow preserves the existing DataRowState, along with other values in
the row."

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist

I have two datasets

ds1, ds2 as mytypedds

I programmatically make a change to a row in ds1

row = ds1.tbl1(0)
row.qty = 5

I then import this row to ds2

ds2.clear()
ds2.tbl1.importrow(row)
row2 = ds2.tbl1(0)

Strangly enough row2.qty = 0, unless I preceed with row.acceptchanges.

What gives?
 
Yes, I read that. "Along with other values in the row" would mean that the
value of qty after importing should be 5 not zero.

Unless "preserve" changed its meaning in the dictionary to me "reset"
 

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

Back
Top