Solved

Database operations

Posted on 2000-03-17
4
164 Views
Last Modified: 2010-04-04
I have a rountine about XTable as the following:

with XTable do
begin
SetRangeStart;
..
..
SetRangeEnd;
..
..
ApplyRange;
Insert;
..
Post;
end;

The first time to call, it is OK, but the second time to call, it stopped at SetRangeEnd and  error message says XTable is not in Edit or Insert mode.
Anyone can tell what is wrong?

Thanks

ysimon
0
Comment
Question by:ysimon
4 Comments
 
LVL 13

Expert Comment

by:Epsylon
Comment Utility
Maybe you have to call 'CancelRange' at the end...
0
 
LVL 2

Expert Comment

by:NetoMan
Comment Utility
Do you make another Update, Insert or Delete sentence by a Tquery or another control in this loop ? What database are you using ?

It´s sound like you have to create a session and terminate it for each iteration.... but that depends on the database you are using and the components.

Hope this help
0
 

Expert Comment

by:westy100697
Comment Utility
ysimon,
       I use some similar code and it works fine...

with XTable do
begin
  IndexFieldNames := 'MYINDEX';
  SetRangeStart;
  ..
  ..
  SetRangeEnd;
  ..
  ..
  ApplyRange;
  First;
  Insert ;
  ..
  Post ;
end;


Cheers,

 WESTY :)
0
 

Accepted Solution

by:
chumba earned 50 total points
Comment Utility
I can only guess what you're trying to do, as the code segment is not descriptive enough.  My GUESS is that you are trying to assign a value to a field in XTable [not shown to us in the code segment].  You definitely should check the dsMode, and put into edit. e.g
   IF XTable.State <> dsEdit  THEN   XTable.Edit
I cannot tell WHY the XTable is not in Edit mode...your manual Post may have had an effect...this could be a bug or 'feature' in Delphi.
 
Hope this helps.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now