Thread View: borland.public.cppbuilder.database.multi-tier
1 messages
1 total messages
Started by agus
Thu, 26 Oct 2000 00:00
Help : UpdateRecordTypes
Author: agus
Date: Thu, 26 Oct 2000 00:00
Date: Thu, 26 Oct 2000 00:00
56 lines
2463 bytes
2463 bytes
I am using C++ Builder ver 3, my database was Oracle 8.0.5.
I have DataModule names LedgerModule. Inside this module,
I have a table names Account.
I set CachedUpdates Property for Account table to true.
I create a user interface form to view/modify Account table.
I using Grid in that form. Then I wrote OnClose event
handler for that Form.
This event handler check wheather Account's table data
has been modified or deleted. If so, a messagebox appear
to remain User wheather she/he will save changes or just
discard them.
The problem is, that messagebox always appear even
there are no changes on data.
Here are the code for that event
void __fastcall TInput_Account::FormClose(TObject *Sender,
TCloseAction &Action)
{
int result;
bool record_was_modified;
record_was_modified = false;
LedgerModule->Account->UpdateRecordTypes.Clear();
LedgerModule->Account->UpdateRecordTypes << rtDeleted <<
rtModified;
for (LedgerModule->Account->First();!LedgerModule->Account->Eof;
LedgerModule->Account->Next());
{
record_was_modified = true;
}
LedgerModule->Account->UpdateRecordTypes << rtModified
<< rtUnmodified << rtInserted;
if (record_was_modified)
{
result = Application->MessageBox(
"Data has change ! Save changes ?",
"Confirmation",MB_YESNOCANCEL + MB_ICONQUESTION );
if (result==IDYES) UpdateBtnClick(Sender);
if (result==IDNO) AbortBtnClick(Sender);
if (result==IDCANCEL) return;
}
}
It seem that UpdateRecordTypes doesn't work well.
Variable record_was_modified (inside for loop) always
assign to true although there were no changes in data.
Please tell me, this error cause from invalid code in my
program or there is a bug in C++ Builder.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads