Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Database operations

Posted on 2000-03-17
4
Medium Priority
?
186 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
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

886 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