Advice needed for Winforms DataBinding w/DataRelations & Updating

D

David Adams

Hi,

I have a fairly complex WinForms app that contains a strongly typed dataset
which contains, for the sake of argument, Customers, Orders, OrderDetails,
CreditCardDetails. The relations are Customers to Orders, Orders to
OrderDetails, and Orders to CreditCardDetails. Each of the tables contain
autoincrements of -1 with a step of -1. These values are then replaced with
SQL generated values when the table is updated.

The form contains a DataGrid, with the data detail below. The idea is that
the grid is read only, and any changes are made by modifying the data detail
below. The grids are bound to a relation (Customers.CustomersOrders) and so
are the textboxes in the data detail below
(Customers.CustomersOrders.OrderID, Customers.CustomersOrders.OrderDate,
etc.).

This works fine until I update. When I perform an update on the underlying
dataset, it seems that the CurrencyManager position for any datarelations
gets reset to -1.

I think the only way around this is to do a ds.GetChanges(), update the
temporary dataset, and then merge the changes back so as to not lose the
position (I haven't tried this yet, I am assuming the position won't
change).

Am I correct in this logic, or am I doing something wrong???

Your suggestions are appreciated!

-- David Adams
 
G

Greg

"I think the only way around this is to do a ds.GetChanges(), update the
temporary dataset, and then merge the changes back so as to not lose the
position (I haven't tried this yet, I am assuming the position won't
change).
"

This is the recommended approach in the docs.
 

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