updating database table using transaction

i use delphi 5

i want update a database table using database transactions

i have a datamodule with a database component (database1) and some table components (table1, table2...)

i wrote for exemple

datamodule.table1.database.starttransaction;
datamodule.table1.edit;
datamodule.table1.fieldbyname('NAME1').AsString := 'something';
......
datamodule.table1.post;
datamodule.table1.database.commit;

the error message i receive is "Nested transaction not supported"

why?

is there an implicit call to starttransaction inside the edit procedure?


monzAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

linus66Commented:
when you start transaction see to that you don have another transaction pending. you can always prevent this by a commit before starttransaction also do a try except routine to handle exceptions...
try
  if datamodule.table1.database.InTransaction Then
    datamodule.table1.database.Commit;

  datamodule.table1.database.starttransaction();

  datamodule.table1.edit();
  datamodule.table1.First();
  while not datamodule.table1.eof do
  Begin
    datamodule.table1.fieldbyname('NAME1').AsString := 'something';
    datamodule.table1.post();
  End;
  if datamodule.table1.database.InTransaction Then
   datamodule.table1.database.commit();
except
  on e:exception do
  begin
     ShowMessage(e.message)
     datamodule.table1.database.RollBack();
  end;
end;

hope it gives a hunt to you..

0
monzAuthor Commented:
nothing is changed
when i call the post metod i receive the same erro message
0
linus66Commented:
Hello.
If you are using bde be sure that the parameter on database alias sqlpassthru mode is set to shared noautocommit.
if you are using paradox tables, they dont support transactions.
if this doesn't help tell me a little more about your configuration(database connectiontype etc).
Good luck..
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CleanupPingCommented:
monz:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.