 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Remo Tex Guest
|
Posted: Fri Nov 14, 2003 10:12 am Post subject: How to Append instead of Insert to DB? |
|
|
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 |
|
 |
|
|
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
|
|