Edit in ADO 
Author Message
 Edit in ADO

Hello everyone.  Sorry to bother with a newbie question.

My understanding is that in ADO, the Edit method has been removed and
editing is assumed if the user changes any data.

This to me is very dangerous, since a user can accidentally change data
without being aware of it.  I would like to place a layer of protection in
the form of a message box to confirm the change.

When I create a form using the data form wizard in ado code mode, I see all
the tantalizing hooks that seem to indicate that this is what others are
doing as well.  I have been digging around the recordset.WillChangeRecord
event in order to place my message box.  If the user answers "no" to keep
changes, I thought that invoking the .updatecancel method would be the
answer.  However, it does not seem to quite work.

I am sure most everyone includes this type of functionality in their data
entry systems.   Could someone send me/show me some example codes?

Thanks in Advance,

Henry Park
AdvanTek Consulting



Tue, 25 Dec 2001 03:00:00 GMT
 Edit in ADO



Quote:
>My understanding is that in ADO, the Edit method has been removed and
>editing is assumed if the user changes any data. This to me is very
>dangerous, since a user can accidentally change data without being
>aware of it.

The application can be coded to submit all changes at once using the
UpdateBatch method.  Similarly, you can code the application to discard
changes unless they explicitly cause an action (like press a "Save"
toolbar icon).  It should be invisible to the user.

Quote:
>  I would like to place a layer of protection in
> the form of a message box to confirm the change.

In the words of Alan Cooper, "Message boxes should only be used to
indicate the user's monitor is on fire." : ) But, you can control this
through code.

Quote:
> I thought that invoking the .updatecancel method would be the
> answer.  However, it does not seem to quite work.

The "CancelUpdate" method of the ADO recordset object does cancel the
current update and rolls back to the previous record.  A quote from the
help file, "If you have not changed the current record or added a new
record, calling the CancelUpdate method generates an error."  You may
want to check your code.

Quote:
> Could someone send me/show me some example codes?

The help file has extensive samples for this method.  See
http://msdn.microsoft.com/library/sdkdoc/dasdk/mdae1liw.htm for code
snippets.

--
Kirk Allen Evans

(Do not send mail to the Deja News account used

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.



Tue, 25 Dec 2001 03:00:00 GMT
 Edit in ADO

Quote:

> My understanding is that in ADO ...<snip>...
> I have been digging around the recordset.WillChangeRecord
> event in order to place my message box.  If the user answers "no" to keep
> changes, I thought that invoking the .updatecancel method would be the
> answer.  However, it does not seem to quite work.

Do you mean CancelUpdate method?
  When you say, "it does not seem to quite work," do you mean that the
record stays changed instead of being returned to its original state?
  Just in case you haven't checked into this, please note that your
*displayed* record can show the changes even after CancelUpdate is
carried out - the underlying record in your table was returned to its
original state, but you need to refresh the display to display that
original record.  One way to do this is with the Bookmark property:
   rs.CancelUpdate
   rs.Bookmark = rs.Bookmark
We cancelled the changes, so the record returned to its original state.
Setting the recordset's Bookmark to itself simply returns the current
record, i.e, the original record - so now the displayed record is the
original, with no edits.
  ...or maybe that's not what you meant?
--
Jim in Cleveland
If you're writing to me, in my address
change "REAL_Address.see.below" to "worldnet.att.net"


Tue, 25 Dec 2001 03:00:00 GMT
 
 [ 3 post ] 

 Relevant Pages 

1. edit an ado recordset using datagrid

2. edit an ado recordset using datagrid

3. Unable to Update/Edit Connectionless ADO Recordset (w/XML)...

4. Unable to Update/Edit Connectionless ADO Recordset (w/XML)...

5. Own Edit, delete, addnew using ADO

6. Help:Editing field values of an ADO recordset returned from SQL SP

7. Editing Stored Procedure with ADO

8. Help: Editing field values of ADO recordset from SQL db

9. Real time ADO Edit

10. VB6 and ADO: can't edit record

11. Editing a field in and ADO record set

12. Edit a record with ADO and ASP


 
Powered by phpBB® Forum Software