M
Mike
I am using a hierarchical DataSet (DataTables linked by DataRelations
on one key, "QtyID"), which is in turn bound to an Infragistics
UltraWinGrid. The idea is that binding this way allows the grid to
display "child" tables as "child" bands. In my app, "QtyID" is what
links the "master" quote table to "child" quote tables.
The problem comes when I have to insert a new quote record. No data
has been pulled from SQL Server on a new quote, so I generate the
QtyID key for the bands, and the user edits the grid accordingly.
Since my QtyID key value is generated, it maps to *no* existing QtyID
key (identity column) in the master quote database table. My original
plan was to discard my generated key, do an INSERT for the master
table, grab the QtyID identity value, and use that in subsequent
INSERTs on the child tables. Since the DataAdapter automatically
calls the InsertCommand for each record in the table, my original idea
seems like it won't work - won't be able to grab the identity
generated QtyID value and use it in a param for the other
InsertCommands.
Do I need to manually go to each record in the master DataTable,
perform an insert, get the identity QtyID value, then go to each each
linked record in the child DataTables, and perform an insert for the
child record using the identity QtyID value? It doesn't seem like
I'll be able to do this with a SQLDataAdapter, since I need to get the
identity QtyID value and replace the old values with it.
Thanks,
Mike
on one key, "QtyID"), which is in turn bound to an Infragistics
UltraWinGrid. The idea is that binding this way allows the grid to
display "child" tables as "child" bands. In my app, "QtyID" is what
links the "master" quote table to "child" quote tables.
The problem comes when I have to insert a new quote record. No data
has been pulled from SQL Server on a new quote, so I generate the
QtyID key for the bands, and the user edits the grid accordingly.
Since my QtyID key value is generated, it maps to *no* existing QtyID
key (identity column) in the master quote database table. My original
plan was to discard my generated key, do an INSERT for the master
table, grab the QtyID identity value, and use that in subsequent
INSERTs on the child tables. Since the DataAdapter automatically
calls the InsertCommand for each record in the table, my original idea
seems like it won't work - won't be able to grab the identity
generated QtyID value and use it in a param for the other
InsertCommands.
Do I need to manually go to each record in the master DataTable,
perform an insert, get the identity QtyID value, then go to each each
linked record in the child DataTables, and perform an insert for the
child record using the identity QtyID value? It doesn't seem like
I'll be able to do this with a SQLDataAdapter, since I need to get the
identity QtyID value and replace the old values with it.
Thanks,
Mike