Select of modified row in update stored procedure command

  • Thread starter Thread starter Duke
  • Start date Start date
D

Duke

I have a data grid that edits a dataset on a windows form. All
database access is via stored procedures against sql server 2000.

The insert stored procedure performs an insert and then a select to
return the inserted data including a system generated primary key,
date inserted and last date modified columns. It works fine.

The update stored procedure performs an update and then a select of
the modified row. The update modifies the last date modified column
and I want this to show in the data grid.

The update stored procedure runs ok. Values changed in the data grid
show as their new values in the data grid, but any other values such
as the last date modified show their old values. I wondered if I was
using the data grid incorrectly, so I saved a diffgram of the dataset
after the dataadapter update call - it shows the unchanged values.

I can work round the problem by issuing just refilling the dataset,
but I'd like to understand why the select from the update stored
procedure is not being picked up.

TIA
Duke
 
Ten minutes after posting I found the cause!
The command object for the update stored procedure had...
cmdUpd.UpdatedRowSource = UpdateRowSource.None;
....which meant it wasn't picking up the select.

Cheers,
Duke
 
Back
Top