Solved

Database operations

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

ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

778 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