Solved

Database operations

Posted on 2000-03-17
4
180 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 50 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses
Course of the Month6 days, 11 hours left to enroll

636 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