Home » U++ Library support » U++ SQL » SqlCtrls and IsModified()
Re: SqlCtrls and IsModified() [message #27002 is a reply to message #26997] |
Sun, 20 June 2010 17:53  |
 |
mirek
Messages: 14266 Registered: November 2005
|
Ultimate Member |
|
|
kropniczki wrote on Sat, 19 June 2010 14:01 | I guess I see what you mean.
In my app context, however, Iīm using push buttons on the main window to load table rows to a SqlCtrls set, so that users can navigate back and forth along the db table lines and alter them if desired. Thatīs why I must check whether changes occurred when moving from one row to the next and update them if thatīs been the case.
In my app thereīs no master SqlArr for users to pick a line from, for then editting the selected row in a SqlCtrls set in a pop-up dlg. Instead, it goes like,
SqlCtrls ctrls;
Value currendId; // -> pointer to table row key id
...
ctrls
(ID, idedit)
(FIELD1, field1edit)
...
(FIELDN, fieldnedit)
;
...
forwardbutton <<= THISBACK(MoveForward);
...
void MoveForward()
{
if(ctrls.IsModified())
SQL * ctrls.Update(TABLE).Where(ID == currentId);
SQL * Select(SqlMin(ID)).From(TABLE).Where(ID > currentId));
if(SQL.Fetch())
currentId = SQL[0];
ctrls.Load(SQL, TABLE, ID == currentId);
ctrls.ClearModify(); // <-- reset modify flag
}
Thanks!
|
Something similar SqlArray can do for automagically. Just use AddCtrl method (of ArrayCtrl).
In fact, SqlCtrls were sort of derived from this arrangement to have something similar in dialogs.
Mirek
|
|
|
Goto Forum:
Current Time: Fri Jul 18 03:19:54 CEST 2025
Total time taken to generate the page: 0.03727 seconds
|