Solved

Transactions on DBGRID

Posted on 1998-09-27
3
242 Views
Last Modified: 2013-12-25
How I do transactions methods BeginTrans, Rollback and Commit in DBGRID32 Bound a datacontrol.
0
Comment
Question by:eduguai
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 6

Expert Comment

by:clifABB
ID: 1487173
You cannot.

There is a problem inherant with all grids that prevent transaction processing.
I have solved this problem in the past by creating a dummy table and moving the data there (which DBGrid reads) then, when done, I move the data back.
0
 

Author Comment

by:eduguai
ID: 1487174
I can create workspace variable and work transactions in events  gotfocus and lostfocus,  because the dbgrid first edit and update records
by example
in gotfocus event:
   vworkspace.begintrans

in lostfocus event:
if msgbox(save data ?) = vbyes
   vworkspace.commit
else
   vworkspace.rollback
endif

and procedure in dbgrid unbound for transaccions in
unboundreaddata, unboundwritedata, ...?
0
 
LVL 13

Accepted Solution

by:
Mirkwood earned 100 total points
ID: 1487175
I'm sorry for the late answer. Somebody answered it and I missed the question.

Ofcourse you can do it. Here is a sample,
On form_load the transaction is started. Depending on OK/Cancel the changes are commited or revoked.

Private Sub CommandCancel_Click()
    Workspaces(0).Rollback
    Unload Me
End Sub

Private Sub CommandOK_Click()
    Workspaces(0).CommitTrans
    Unload Me
End Sub

Private Sub Form_Load()
    Workspaces(0).BeginTrans
End Sub

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month5 days, 2 hours left to enroll

635 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question