Link to home
Start Free TrialLog in
Avatar of Pea913
Pea913

asked on

How to get the original value in dataset.

I have to get the previous value of a certain cell in a datagrid.

I used dataset.getchanges to get the rows that has changed.

On modified rows I will update the database using a stored procedure. It is impossible that I use the ds.update since the dataset table is not equal to the real database table.

What I did was, I used the sqlcommand object to call the stored proc.

My problem is, in passing parameters to an update procedure, you need to provide the primary key values of the table. But in my case, the primary column is also changeable. I need to know the original value of the row i am going to save.

Thanks in advance.
Avatar of arvindb1
arvindb1

Clone the dataset after populating like this
Dim ods1 As DataSet = ods.Clone()
then use one dataset for old values and new dataset for changed values, then you can have the values.

Arvind
Avatar of Pea913

ASKER


I already did that.

But my problem is, the return recordset of getchanged, does not include the original row number. I still cannot refer it to the cloned dataset.

Flor
A quick and dirty solution to this problem is to have the primary key values in your dataset twice.

Once for reference (and not displayed in the datagrid) and once displayed in the datagrid so that they can be changed.
ASKER CERTIFIED SOLUTION
Avatar of wile_e_coyote
wile_e_coyote

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial