Board index » delphi » Very strange behaviour of BDE

Very strange behaviour of BDE

   Hello!
Who can explain such situation?
We have 3 line of program:
//
agreeInd = tblAgree->FieldByName("Agree_key")->AsInteger;
tblAgree->Edit();
agreeInd = tblAgree->FieldByName("Agree_key")->AsInteger;
//
After executing the first line agreeInd == 3782;
And after executing the third line agreeInd == 2054.
It is very strangely is not it?

  Bernard A. Beizman

 

Re:Very strange behaviour of BDE


What database are you using???

On Tue, 17 Sep 2002 09:09:59 +0400, "bba" <b...@gpb-sar.renet.ru>
wrote:

Quote
>   Hello!
>Who can explain such situation?
>We have 3 line of program:
>//
>agreeInd = tblAgree->FieldByName("Agree_key")->AsInteger;
>tblAgree->Edit();
>agreeInd = tblAgree->FieldByName("Agree_key")->AsInteger;
>//
>After executing the first line agreeInd == 3782;
>And after executing the third line agreeInd == 2054.
>It is very strangely is not it?

>  Bernard A. Beizman

--
Bill (TeamB)
(TeamB cannot respond to questions received via email)

Re:Very strange behaviour of BDE


Try rebuilding the table with the table repair program at
www.rksolution.cz . The table or the primary index may be corrupt.

On Wed, 18 Sep 2002 08:30:50 +0400, "bba" <b...@gpb-sar.renet.ru>
wrote:

Quote
>Hello!
>I'm using Paradox tables;
>Thank you,
>Bernard A. Beizman

>Bill Todd <b...@notthis.dbginc.com> ??? a
>????:2vbeougpph8qv68lpb572uefmijtvlp...@4ax.com...
>> What database are you using???

>> On Tue, 17 Sep 2002 09:09:59 +0400, "bba" <b...@gpb-sar.renet.ru>
>> wrote:

>> >   Hello!
>> >Who can explain such situation?
>> >We have 3 line of program:
>> >//
>> >agreeInd = tblAgree->FieldByName("Agree_key")->AsInteger;
>> >tblAgree->Edit();
>> >agreeInd = tblAgree->FieldByName("Agree_key")->AsInteger;
>> >//
>> >After executing the first line agreeInd == 3782;
>> >And after executing the third line agreeInd == 2054.
>> >It is very strangely is not it?

>> >  Bernard A. Beizman

>> --
>> Bill (TeamB)
>> (TeamB cannot respond to questions received via email)

--
Bill (TeamB)
(TeamB cannot respond to questions received via email)

Re:Very strange behaviour of BDE


Yes, I've tested all tables in directory. There were not errors. Have you
any other ideas?

Bernard A. Beizman

Bill Todd <b...@notthis.dbginc.com> ??? a
????:luahouge15sai75pp3rsv2svat5b7qa...@4ax.com...

Quote
> Try rebuilding the table with the table repair program at
> www.rksolution.cz . The table or the primary index may be corrupt.

> On Wed, 18 Sep 2002 08:30:50 +0400, "bba" <b...@gpb-sar.renet.ru>
> wrote:

> >Hello!
> >I'm using Paradox tables;
> >Thank you,
> >Bernard A. Beizman

> >Bill Todd <b...@notthis.dbginc.com> ??? a
> >????:2vbeougpph8qv68lpb572uefmijtvlp...@4ax.com...
> >> What database are you using???

> >> On Tue, 17 Sep 2002 09:09:59 +0400, "bba" <b...@gpb-sar.renet.ru>
> >> wrote:

> >> >   Hello!
> >> >Who can explain such situation?
> >> >We have 3 line of program:
> >> >//
> >> >agreeInd = tblAgree->FieldByName("Agree_key")->AsInteger;
> >> >tblAgree->Edit();
> >> >agreeInd = tblAgree->FieldByName("Agree_key")->AsInteger;
> >> >//
> >> >After executing the first line agreeInd == 3782;
> >> >And after executing the third line agreeInd == 2054.
> >> >It is very strangely is not it?

> >> >  Bernard A. Beizman

> >> --
> >> Bill (TeamB)
> >> (TeamB cannot respond to questions received via email)

> --
> Bill (TeamB)
> (TeamB cannot respond to questions received via email)

Re:Very strange behaviour of BDE


Create a new application. Add a button and copy the three lines of
code from your original message to the OnClick event handler of the
button. Add a TDatabase and TTable and connect them to the table? Do
you still get the same behavior?

--
Bill (TeamB)
(TeamB cannot respond to questions received via email)

Re:Very strange behaviour of BDE


Certainly not!
I even have right behaviourof program if I insert following lines before
above three:

TBookmark bm, bmAgree;
bm = tblOpers->GetBookmark();
bmAgree = tblAgree->GetBookmark();
while(DataMod1->tblOpers->FindNext())
{
  DataMod1->tblOpers->Edit();
  ModifyRemainders(prevRemBase,prevRemPercent,prevRemTax);
  DataMod1->tblOpers->Post();

Quote
}

tblAgree->GotoBookmark(bmAgree);
tblAgree->FreeBookmark(bmAgree);
DataMod1->tblOpers->GotoBookmark(bm);
DataMod1->tblOpers->FreeBookmark(bm);

By the way tblOpers has  tblAgree as MasterSource and ModifyRemainders
scrolls tblOpers till tblOpers->FindNext() == false. May be the reason is
that?
If so, than whose mistake it is?
  Bernard A. Beizman

Bill Todd <b...@notthis.dbginc.com> ??? a
????:psljouo9v7uttvgkf885s95p48oi7bg...@4ax.com...

Quote
> Create a new application. Add a button and copy the three lines of
> code from your original message to the OnClick event handler of the
> button. Add a TDatabase and TTable and connect them to the table? Do
> you still get the same behavior?

> --
> Bill (TeamB)
> (TeamB cannot respond to questions received via email)

Re:Very strange behaviour of BDE


On Thu, 19 Sep 2002 19:00:22 +0400, "bba" <b...@gpb-sar.renet.ru>
wrote:

Quote
>Certainly not!

That means the problem is caused by something in your code. The only
way to find the cause is to trace through your code one line at a time
in the de{*word*81}.

--
Bill (TeamB)
(TeamB cannot respond to questions received via email)

Re:Very strange behaviour of BDE


I have not BeforeEdit and AfterEdit Events for table tblAgree.
I can not find "with Debug dcu's" option on the compiler option page.
Perhaps you meant "Use Debug Libraries" on Linker Page? I've chosen this
option, but when I try to watch return value of
tblAgree->FieldByName("Agree_key")->AsInteger, I got the message "Can not
evaluate the function call". So it does not help.
 Sincerely,
  Bernard A. Beizman

Dipsy <Di...@Teletubbie.land> D???
???Y??:3d8ac...@newsgroups.borland.com...

Quote
> Just a guess. Do you have a BeforeEdit-Event or AfterEdit-Event
> in your app for the table tblAgree ?

> If not you should activate the option "with Debug dcu's" on the compiler
> options page and walk step by step (F7) through your code and the VCL
> code watching the return value of

tblAgree->FieldByName("Agree_key")->AsInteger
Quote
> after every step.

> "bba" <b...@gpb-sar.renet.ru> schrieb im Newsbeitrag

news:3d8ab0bf@newsgroups.borland.com...
Quote
> > Certainly I inspected my program and those 3 lines in de{*word*81}. The
matter
> > is that three lines which I mentioned in first message, following one
after
> > another without any line between them.
> > I can not realize what kind of code my cause such behaviour.
> > I think it is wrong to make conclusion, that if a program consisting of
3
> > line works fine and more complex program behave wrong, than problem only
in
> > the code of program.
> > {
> > agreeInd = tblAgree->FieldByName("Agree_key")->AsInteger;
> > /* agreeInd == 3782 */
> > tblAgree->Edit();
> > agreeInd = tblAgree->FieldByName("Agree_key")->AsInteger
> > /* agreeInd == 2054 */
> > }
> > Sincerely,
> > Bernard A. Beizman

> > Bill Todd <b...@notthis.dbginc.com> ??? a
> > ????:9tujouc341evu0c0fld337km2bq5tp0...@4ax.com...

> > > On Thu, 19 Sep 2002 19:00:22 +0400, "bba" <b...@gpb-sar.renet.ru>
> > > wrote:

> > > >Certainly not!

> > > That means the problem is caused by something in your code. The only
> > > way to find the cause is to trace through your code one line at a time
> > > in the de{*word*81}.

> > > --
> > > Bill (TeamB)
> > > (TeamB cannot respond to questions received via email)

Re:Very strange behaviour of BDE


What code is in the BeforeEdit and AfterEdit event handlers of the
TTable? What code is in the OnStateChange event handler of the
TDataSource?

--
Bill (TeamB)
(TeamB cannot respond to questions received via email)

Re:Very strange behaviour of BDE


Also, when you step through the three lines of code in the de{*word*81}
make sure you use F7 (trace into) and not F8 (step over) so you will
trace through any event handlers that fire.

--
Bill (TeamB)
(TeamB cannot respond to questions received via email)

Re:Very strange behaviour of BDE


Are you performing your edit/post within a loop?

Something like.

while (!tblAgree->Eof)
{
   tblAgree->Edit();
   ...
   tblAgree->Post();
   tblAgree->Next();

Quote
}

Matt Jacobs

--

My reply-to address is purposely mangled to thwart auto-reply bots.
Please remove the two leading underscores if you wish to reply via
e-mail.

Other Threads