Solved

Transactions on DBGRID

Posted on 1998-09-27
3
240 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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…

751 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