Grid Development

Hi all

Ok heres my query...

I have a grid which i use to display data extracted from a database.
I want this grid to be editable, but want that the changes are made in the database only when i press the command button "Save"

However, currently I am facing the problem, that even if i Press Cancel, any changes made in the grid are saved to the database. Can I prevent this dynamic save in any way????

Pls help.


THx
Megha
meghaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

meghaAuthor Commented:
my current code is this:

Private Sub cmdCancel_Click()
Unload Me
End Sub

Private Sub Form_Load()

Call Open_rneVersionCtrl

Set dbgProdVersCtrl.DataSource = frmLogin.rneVersionCtrl

dbgProdVersCtrl.Columns(0).Locked = True
dbgProdVersCtrl.Columns(1).Locked = True

End Sub

Public Sub Open_rneVersionCtrl()

'close record set if it is open
If frmLogin.rneVersionCtrl.State = adStateOpen Then frmLogin.rneVersionCtrl.Close

frmLogin.rneVersionCtrl.CursorLocation = adUseClient 'set the CursorLoccation for rneUser

frmLogin.rneVersionCtrl.Open "SELECT Proj_Prod_Relation.product, Version_Control.* FROM Proj_Prod_Relation, Version_Control WHERE Version_Control.projPRodID = Proj_Prod_Relation.projProdID AND Proj_Prod_Relation.customerID = '" & custIDSelected & "' AND Proj_Prod_Relation.projectID = '" & projectIDSelected & "'", frmLogin.cneSupport, adOpenStatic, adLockOptimistic

End Sub

Hope this helps....
0
supunrCommented:
why not use trasactions.

e.g.

Private Commit as boolean
Private conn as ADODB.Connection

Private Sub Form_Load()
   Commit = false
   ' Open the connection
   Set conn = new ADODB.Connection
   conn.Open "<your connection string>"
   ' begin trasaction
   conn.BeginTrans
End Sub

Private cmdOK_Click()
    Commit = true
    Unload Me
ENd Sub

Private cmdCancel_Click()
    Unload Me
ENd Sub

Private Sub Form_Unload()
    If (conn.State = adStateOpen) then
        if (Commit) then
            conn.CommitTrans  ' save changes
        else
            conn.RollbackTrans 'undo changes
        End if
        conn.close
        set conn = nothing
    end if
End Sub
0
meghaAuthor Commented:
Hi thx
will try and get back to u on the result
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

inthedarkCommented:
The other way is to use a disconnected record set.  Or disconnected the recordset after you read but before you display the data.
0
meghaAuthor Commented:
hi i tried using cancel update and that worked..

but thx for yur help.. transactions was giving me some problem

0
MindphaserCommented:
Points refunded and moved to PAQ

** Mindphaser - Community Support Moderator **
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.