BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to Append instead of Insert to DB?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (dbExpress)
View previous topic :: View next topic  
Author Message
Remo Tex
Guest





PostPosted: Fri Nov 14, 2003 10:12 am    Post subject: How to Append instead of Insert to DB? Reply with quote



Delphi7, dbExpress, MySQL 3.23 (but any other will do)
] The problem: Is there any EASY way to let Insert (OnInsert) behave as
Append instead? Not programatically but thru DBNavigator button or Ins
Key or Down (arrow) pressed.
This is very specific case for only 1 table in datamodule but...
My current solution isn't very satisfactory:
OnInsert():
if Tag > 1 then begin //Appen also fires OnInsert
Tag := 0; // Append fired
end else begin // real Insert
Inc(Tag);
//or raise some exception // System.Abort - I've just heard about silent
exceptions
DataSet.Cancel;
DataSet.Append;
end
That does the trick, but recently I had to rewrite that App, so now I
have OnBeforeInsert.. etc. and things have gone more complicated e.g.:
OnBeforeInsert := nil; // then try catch because I need OnBeforeXXX
set-up again
So:
1. Is there a way to
1.1. Cancel Insert (and where, dataset, clientdataset, what about
SimpleDataset)
1.2. How to Append (fires OnInsert again) the easy way i.e. without
Re-setting back OnXXX event handlers
or it will be easy if there is some property somewhere to let Insert to
ONLY append in Tables.

] The solution - that's up to you...

Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (dbExpress) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.