DataView Question

  • Thread starter Thread starter Paul J. Lay
  • Start date Start date
P

Paul J. Lay

I have a form that is passed byRef a dataView which is can updated many
times in the form. If the user decides to Cancel all the updates, I would
like to be able to restore the dataView to its contents at entry to the
contructor. Reject changes works fine in my form but causes other problems
for the caller of my form. I would to be able to clone or save a dataView
and restore it from the saved copy if a user decides to cancel the session.
Can you tell me the best way to do this? Thanks for your help.

Best Regards,

Paul J.Lay
 
Hi Paul,

Two answers trying to make it clear.

1. answer
A dataview is only a big reference box. It holds no data, so when you want
to save the data before it will be needed that you first copy the data to an
extra table.

I do not know the language you are using so in pseudo by instance

Create a new datatable and copy that to the table you are using with
dv.table.copy (this one I never tried however I would not know why not)

2. answer
Passing a dataview byRef is only extra overhead and confusing for others who
reads your program. There are very few reasons why you would use ByRef in a
dotNet program, the only two I know is when the object is new created in the
method (or in another way the reference changed) or when it is a value (What
I never would do).

Passing an object byval is passing the value of the reference of that
object.

I hope this helps?

Cor
 
Why do suggest copy instead of clone? I initially tired clone but then when
I attempted to obtain the row counts on the cloned table, the counts were
zero. Thanks for your help.

Best Regards,

Paul J. Lay
 
Paul,
Why do suggest copy instead of clone? I initially tired clone but then when
I attempted to obtain the row counts on the cloned table, the counts were
zero. Thanks for your help.
You wrote the answer yourself
clone is the clone of a dataset with exception from the data.
copy is a copy of a full dataset with all its references

However why do you ask questions, get answers and than try something else
first?

Cor
 
Back
Top