Adding Records strange behavour

Discussion of open issues, suggestions and bugs regarding Virtual Data Access Components for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
rstubbe
Posts: 4
Joined: Tue 11 Jul 2006 15:04

Adding Records strange behavour

Post by rstubbe » Tue 13 Mar 2007 10:18

I am trying to add 3 records to a virtual table.

If the table is empty, 4 records are created, the first record contains only the value of the first field, the other 3 records are correct.

If the table contains data, the first record gets the first field updated, and 3 new records gets created correctly.

The source of what i do is:
-------------------------------------------------------------------------------------
String Server;

Server = frmSetup->fldServerName->Text;
frmMain->tblSettings->FindLast();
frmMain->tblSettings->Append();
frmMain->tblSettings->FieldByName("fldServer")->SetData(Server.c_str(),true);
frmMain->tblSettings->FieldByName("fldApplication")->SetData("Server",true);
frmMain->tblSettings->FieldByName("fldParameter")->SetData("Address",true);
frmMain->tblSettings->FieldByName("fldValue")->SetData(frmSetup->fldServerIP->Text.c_str(),true);
frmMain->tblSettings->Post();
frmMain->tblSettings->Append();
frmMain->tblSettings->FieldByName("fldServer")->SetData(Server.c_str(),true);
frmMain->tblSettings->FieldByName("fldApplication")->SetData("Server",true);
frmMain->tblSettings->FieldByName("fldParameter")->SetData("SID",true);
frmMain->tblSettings->FieldByName("fldValue")->SetData(frmSetup->fldServerSID->Text.c_str(),true);
frmMain->tblSettings->Post();
frmMain->tblSettings->Append();
frmMain->tblSettings->FieldByName("fldServer")->SetData(Server.c_str(),true);
frmMain->tblSettings->FieldByName("fldApplication")->SetData("Server",true);
frmMain->tblSettings->FieldByName("fldParameter")->SetData("Password",true);
frmMain->Aanpassen = frmSetup->fldServerPassword->Text;
pencode(Sender);
frmMain->tblSettings->FieldByName("fldValue")->SetData(frmMain->Aanpassen.c_str(),true);
frmMain->tblSettings->Post();
-------------------------------------------------------------------------------------

Note that nowhere in the application is any code working with this table.

Any one got a clue on this exta record update?

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Wed 04 Apr 2007 13:22

I could not reproduce the problem. Please send me a complete small sample at evgeniyD*crlab*com to demonstrate it.
Also supply me the following information:
- exact version of C++Builder;
- exact version of TVirtualTable. You can do this by checking value the DacVersion variable at run time.

rstubbe
Posts: 4
Joined: Tue 11 Jul 2006 15:04

Solved

Post by rstubbe » Wed 04 Apr 2007 17:20

The problem has been resolved.

The issue was with the first field which was a TDBLookupListBox.
Appearently this listbox updated 1 record before the program was run to add tree records.

After changing this to a normal TListBox, and filling that with the database values, the problem was solved.

Sorry for net reporting this sooner (it took me almost 2 days to figure this out).

This was with Borland Developer Studio Pro 2006 and ODAC 5.70

Thanks foy your support.

Post Reply