Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Database operations

Posted on 2000-03-17
4
Medium Priority
?
184 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 13

Expert Comment

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

Expert Comment

by:NetoMan
ID: 2630314
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
ID: 2638624
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 100 total points
ID: 2653854
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

730 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