Save changes on closeform

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Fm
Posts: 1
Joined: Sun 27 Aug 2006 06:31

Save changes on closeform

Post by Fm » Sun 27 Aug 2006 06:32

Dear All

I'm using SDAC 3.50 on Delphi 7.1. I have 2 forms for cutomers:

1- The first form is for displaying in a dbgrid Some details of the customers. The form contains a Dbgrid, a datasource, a Tmsquerry and 3 buttons (New, Edit and delete). (the querry is in browse mode only – No Editing)
2- The second form is for Editing, Posting new records and deleting With one other querry.

My first problem is how to send the current record to the second form for editing or deleting.

My second problem is that When the user has do some changes without posting (New record or when editing) and wants to close the second form, I Want to ask him before closing the form if he wants to save the changes or not. The property (Changecount used in dbexpress don't exist in Sdac).

Thanks a lot for your help.

Jackson
Posts: 512
Joined: Thu 26 Jan 2006 10:06

Post by Jackson » Tue 29 Aug 2006 06:19

> My first problem is how to send the current record to the second form for editing or deleting.
The most common case without using additional query: your edit form contains db-aware controls linked to DataSet on main form. Before opening edit form you call TDataSet.Edit or TDataSet.Insert method. After all changes are made you call TDataSet.Post method to accept changes or TDataSet.Cancel to cancel them.

> Changecount used in dbexpress don't exist in Sdac
You can use TDataSet.Modified property to determine if the active record is modified or not.

Post Reply