ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/trunk/examples/employee/unit1.pas
(Generate patch)

Comparing ibx/trunk/examples/employee/unit1.pas (file contents):
Revision 7 by tony, Sun Aug 5 18:28:19 2012 UTC vs.
Revision 21 by tony, Thu Feb 26 10:33:34 2015 UTC

# Line 1 | Line 1
1 < unit Unit1;
2 <
3 < {$mode objfpc}{$H+}
4 <
5 < interface
6 <
7 < uses
8 <  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, DBGrids,
9 <  StdCtrls, ActnList, IBDatabase, IBQuery, IBCustomDataSet, IBUpdateSQL, db;
10 <
11 < type
12 <
13 <  { TForm1 }
14 <
15 <  TForm1 = class(TForm)
16 <    CancelChanges: TAction;
17 <    IBUpdateSQL1: TIBUpdateSQL;
18 <    SaveChanges: TAction;
19 <    DeleteEmployee: TAction;
20 <    EditEmployee: TAction;
21 <    AddEmployee: TAction;
22 <    ActionList1: TActionList;
23 <    Button1: TButton;
24 <    Button2: TButton;
25 <    Button3: TButton;
26 <    Button4: TButton;
27 <    Button5: TButton;
28 <    Datasource1: TDatasource;
29 <    DBGrid1: TDBGrid;
30 <    IBDatabase1: TIBDatabase;
31 <    IBQuery1: TIBQuery;
32 <    IBQuery1DEPT_NO: TIBStringField;
33 <    IBQuery1EMP_NO: TSmallintField;
34 <    IBQuery1FIRST_NAME: TIBStringField;
35 <    IBQuery1FULL_NAME: TIBStringField;
36 <    IBQuery1HIRE_DATE: TDateTimeField;
37 <    IBQuery1JOB_CODE: TIBStringField;
38 <    IBQuery1JOB_COUNTRY: TIBStringField;
39 <    IBQuery1JOB_GRADE: TSmallintField;
40 <    IBQuery1LAST_NAME: TIBStringField;
41 <    IBQuery1PHONE_EXT: TIBStringField;
42 <    IBQuery1SALARY: TIBBCDField;
43 <    IBTransaction1: TIBTransaction;
44 <    procedure AddEmployeeExecute(Sender: TObject);
45 <    procedure CancelChangesExecute(Sender: TObject);
46 <    procedure DBGrid1DblClick(Sender: TObject);
47 <    procedure DeleteEmployeeExecute(Sender: TObject);
48 <    procedure EditEmployeeExecute(Sender: TObject);
49 <    procedure EditEmployeeUpdate(Sender: TObject);
50 <    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
51 <    procedure FormShow(Sender: TObject);
52 <    procedure IBDatabase1AfterConnect(Sender: TObject);
53 <    procedure IBDatabase1BeforeDisconnect(Sender: TObject);
54 <    procedure IBQuery1AfterDelete(DataSet: TDataSet);
55 <    procedure IBQuery1AfterOpen(DataSet: TDataSet);
56 <    procedure IBQuery1AfterTransactionEnd(Sender: TObject);
57 <    procedure IBQuery1BeforeClose(DataSet: TDataSet);
58 <    procedure IBQuery1BeforeOpen(DataSet: TDataSet);
59 <    procedure IBQuery1PostError(DataSet: TDataSet; E: EDatabaseError;
60 <      var DataAction: TDataAction);
61 <    procedure IBQuery1SALARYGetText(Sender: TField; var aText: string;
62 <      DisplayText: Boolean);
63 <    procedure SaveChangesExecute(Sender: TObject);
64 <    procedure SaveChangesUpdate(Sender: TObject);
65 <  private
66 <    { private declarations }
67 <    FDirty: boolean;
68 <    FClosing: boolean;
69 <    FLastEmp_no: integer;
70 <    procedure Reopen(Data: PtrInt);
71 <  public
72 <    { public declarations }
73 <  end;
74 <
75 < var
76 <  Form1: TForm1;
77 <
78 < implementation
79 <
80 < {$R *.lfm}
81 <
82 < uses Unit2, Unit3, IB;
83 <
84 < function ExtractDBException(msg: string): string;
85 < var Lines: TStringList;
86 < begin
87 <     Lines := TStringList.Create;
88 <     try
89 <       Lines.Text := msg;
90 <       if pos('exception',Lines[0]) = 1 then
91 <         Result := Lines[2]
92 <       else
93 <         Result := msg
94 <     finally
95 <       Lines.Free
96 <     end;
97 < end;
98 <
99 < { TForm1 }
100 <
101 < procedure TForm1.IBQuery1SALARYGetText(Sender: TField; var aText: string;
102 <  DisplayText: Boolean);
103 < begin
104 <  if DisplayText then
105 <  begin
106 <    if Sender.IsNUll then
107 <      aText := ''
108 <    else
109 <      aText := FormatFloat('$#,##0.00',Sender.AsFloat)
110 <  end
111 <  else
112 <    aText := Sender.AsString
113 < end;
114 <
115 < procedure TForm1.SaveChangesExecute(Sender: TObject);
116 < begin
117 <  IBQuery1.Transaction.Commit
118 < end;
119 <
120 < procedure TForm1.SaveChangesUpdate(Sender: TObject);
121 < begin
122 <  (Sender as TAction).Enabled := FDirty
123 < end;
124 <
125 < procedure TForm1.Reopen(Data: PtrInt);
126 < begin
127 <  with IBTransaction1 do
128 <    if not InTransaction then StartTransaction;
129 <  IBQuery1.Active := true
130 < end;
131 <
132 < procedure TForm1.AddEmployeeExecute(Sender: TObject);
133 < var NewEmpNo: integer;
134 < begin
135 <  if AddEmployeeDlg.ShowModal(NewEmpNo) = mrOK then
136 <  begin
137 <    FDirty := true;
138 <    IBQuery1.Active := false;
139 <    FLastEmp_no := NewEmpNo;
140 <    IBQuery1.Active := true
141 <  end;
142 < end;
143 <
144 < procedure TForm1.CancelChangesExecute(Sender: TObject);
145 < begin
146 <  IBQuery1.Transaction.Rollback
147 < end;
148 <
149 < procedure TForm1.DBGrid1DblClick(Sender: TObject);
150 < begin
151 <  if IBQuery1.Active and (IBQuery1.RecordCount > 0) then
152 <    EditEmployeeExecute(nil)
153 < end;
154 <
155 < procedure TForm1.DeleteEmployeeExecute(Sender: TObject);
156 < begin
157 <  if MessageDlg(
158 <    Format('Remove %s from Employee List?',[IBQuery1.FieldByName('Full_Name').AsString]),
159 <    mtConfirmation,[mbYes,mbNo],0) = mrYes then
160 <    IBQuery1.Delete
161 < end;
162 <
163 < procedure TForm1.EditEmployeeExecute(Sender: TObject);
164 < begin
165 <  if EditEmployeeDlg.ShowModal(IBQuery1.FieldByName('Emp_No').AsInteger) = mrOK then
166 <  begin
167 <    FDirty := true;
168 <    IBQuery1.Refresh
169 <  end;
170 < end;
171 <
172 < procedure TForm1.EditEmployeeUpdate(Sender: TObject);
173 < begin
174 <  (Sender as TAction).Enabled := IBQuery1.Active and (IBQuery1.RecordCount > 0)
175 < end;
176 <
177 < procedure TForm1.FormClose(Sender: TObject; var CloseAction: TCloseAction);
178 < begin
179 <  FClosing := true
180 < end;
181 <
182 < procedure TForm1.FormShow(Sender: TObject);
183 < begin
184 <  FLastEmp_no := -1;
185 <  IBQuery1.Active := true
186 < end;
187 <
188 < procedure TForm1.IBDatabase1AfterConnect(Sender: TObject);
189 < begin
190 <  with IBTransaction1 do
191 <    if not InTransaction then StartTransaction
192 < end;
193 <
194 < procedure TForm1.IBDatabase1BeforeDisconnect(Sender: TObject);
195 < begin
196 <  FClosing := true
197 < end;
198 <
199 < procedure TForm1.IBQuery1AfterDelete(DataSet: TDataSet);
200 < begin
201 <  FDirty := true
202 < end;
203 <
204 < procedure TForm1.IBQuery1AfterOpen(DataSet: TDataSet);
205 < begin
206 <  if FLastEmp_no <> -1 then
207 <    DataSet.Locate('EMP_NO',FLastEmp_no,[])
208 < end;
209 <
210 < procedure TForm1.IBQuery1AfterTransactionEnd(Sender: TObject);
211 < begin
212 <  FDirty := false;
213 <  if not FClosing then
214 <    Application.QueueAsyncCall(@Reopen,0)
215 < end;
216 <
217 < procedure TForm1.IBQuery1BeforeClose(DataSet: TDataSet);
218 < begin
219 <  FLastEmp_no := DataSet.FieldByName('Emp_no').AsInteger
220 < end;
221 <
222 < procedure TForm1.IBQuery1BeforeOpen(DataSet: TDataSet);
223 < begin
224 < end;
225 <
226 < procedure TForm1.IBQuery1PostError(DataSet: TDataSet; E: EDatabaseError;
227 <  var DataAction: TDataAction);
228 < begin
229 <  if E is EIBError then
230 <   begin
231 <       MessageDlg(ExtractDBException(EIBError(E).message),mtError,[mbOK],0);
232 <       DataSet.Cancel;
233 <       DataAction  := daAbort
234 <   end;
235 < end;
236 <
237 < end.
238 <
1 > unit Unit1;
2 >
3 > {$mode objfpc}{$H+}
4 >
5 > interface
6 >
7 > uses
8 >  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, DBGrids,
9 >  StdCtrls, ActnList, EditBtn, DbCtrls, ExtCtrls, Buttons, IBDatabase, IBQuery,
10 >  IBCustomDataSet, IBUpdateSQL, IBDynamicGrid, IBLookupComboEditBox,
11 >  db, DBExtCtrls;
12 >
13 > type
14 >
15 >  { TForm1 }
16 >
17 >  TForm1 = class(TForm)
18 >    DBEdit6: TDBEdit;
19 >    EmployeesDEPT_KEY_PATH: TIBStringField;
20 >    EmployeesDEPT_PATH: TIBStringField;
21 >    IBLookupComboEditBox1: TIBLookupComboEditBox;
22 >    IBLookupComboEditBox2: TIBLookupComboEditBox;
23 >    SelectDept: TAction;
24 >    Button4: TButton;
25 >    Button5: TButton;
26 >    CancelChanges: TAction;
27 >    SalaryRange: TComboBox;
28 >    CountrySource: TDataSource;
29 >    BeforeDate: TDateEdit;
30 >    AfterDate: TDateEdit;
31 >    DeptsSource: TDataSource;
32 >    Depts: TIBQuery;
33 >    JobCodeSource: TDataSource;
34 >    DBEdit1: TDBEdit;
35 >    DBEdit2: TDBEdit;
36 >    DBEdit3: TDBEdit;
37 >    DBEdit4: TDBEdit;
38 >    DBEdit5: TDBEdit;
39 >    DBText1: TDBText;
40 >    Employees: TIBDataSet;
41 >    EmployeesDEPT_NO: TIBStringField;
42 >    EmployeesEMP_NO: TSmallintField;
43 >    EmployeesFIRST_NAME: TIBStringField;
44 >    EmployeesFULL_NAME: TIBStringField;
45 >    EmployeesHIRE_DATE: TDateTimeField;
46 >    EmployeesJOB_CODE: TIBStringField;
47 >    EmployeesJOB_COUNTRY: TIBStringField;
48 >    EmployeesJOB_GRADE: TSmallintField;
49 >    EmployeesLAST_NAME: TIBStringField;
50 >    EmployeesPHONE_EXT: TIBStringField;
51 >    EmployeesSALARY: TIBBCDField;
52 >    IBDateEdit1: TDBDateEdit;
53 >    IBDynamicGrid1: TIBDynamicGrid;
54 >    Countries: TIBQuery;
55 >    JobCodes: TIBQuery;
56 >    JobGradeDBComboBox: TDBComboBox;
57 >    Label10: TLabel;
58 >    Label11: TLabel;
59 >    Label12: TLabel;
60 >    Label13: TLabel;
61 >    Label3: TLabel;
62 >    Label4: TLabel;
63 >    Label5: TLabel;
64 >    Label6: TLabel;
65 >    Label7: TLabel;
66 >    Label8: TLabel;
67 >    Label9: TLabel;
68 >    Panel1: TPanel;
69 >    Panel2: TPanel;
70 >    EmployeeEditorPanel: TPanel;
71 >    SpeedButton1: TSpeedButton;
72 >    TotalsQueryTOTALSALARIES: TIBBCDField;
73 >    TotalsSource: TDataSource;
74 >    TotalsQuery: TIBQuery;
75 >    Label1: TLabel;
76 >    Label2: TLabel;
77 >    SaveChanges: TAction;
78 >    DeleteEmployee: TAction;
79 >    EditEmployee: TAction;
80 >    AddEmployee: TAction;
81 >    ActionList1: TActionList;
82 >    Button1: TButton;
83 >    Button2: TButton;
84 >    Button3: TButton;
85 >    EmployeeSource: TDataSource;
86 >    IBDatabase1: TIBDatabase;
87 >    IBTransaction1: TIBTransaction;
88 >    procedure EmployeesAfterPost(DataSet: TDataSet);
89 >    procedure JobGradeDBComboBoxCloseUp(Sender: TObject);
90 >    procedure SelectDeptExecute(Sender: TObject);
91 >    procedure AddEmployeeExecute(Sender: TObject);
92 >    procedure BeforeDateChange(Sender: TObject);
93 >    procedure CancelChangesExecute(Sender: TObject);
94 >    procedure CountriesBeforeOpen(DataSet: TDataSet);
95 >    procedure DeleteEmployeeExecute(Sender: TObject);
96 >    procedure EditEmployeeExecute(Sender: TObject);
97 >    procedure EditEmployeeUpdate(Sender: TObject);
98 >    procedure EmployeesAfterInsert(DataSet: TDataSet);
99 >    procedure EmployeesAfterOpen(DataSet: TDataSet);
100 >    procedure EmployeesAfterScroll(DataSet: TDataSet);
101 >    procedure EmployeesBeforeClose(DataSet: TDataSet);
102 >    procedure EmployeesBeforeOpen(DataSet: TDataSet);
103 >    procedure EmployeesJOB_CODEChange(Sender: TField);
104 >    procedure EmployeesJOB_GRADEChange(Sender: TField);
105 >    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
106 >    procedure FormShow(Sender: TObject);
107 >    procedure EmployeesAfterDelete(DataSet: TDataSet);
108 >    procedure EmployeesAfterTransactionEnd(Sender: TObject);
109 >    procedure EmployeesPostError(DataSet: TDataSet; E: EDatabaseError;
110 >      var DataAction: TDataAction);
111 >    procedure EmployeesSALARYGetText(Sender: TField; var aText: string;
112 >      DisplayText: Boolean);
113 >    procedure JobCodesBeforeOpen(DataSet: TDataSet);
114 >    procedure SaveChangesExecute(Sender: TObject);
115 >    procedure SaveChangesUpdate(Sender: TObject);
116 >  private
117 >    { private declarations }
118 >    FDirty: boolean;
119 >    FClosing: boolean;
120 >    procedure Reopen(Data: PtrInt);
121 >  public
122 >    { public declarations }
123 >  end;
124 >
125 > var
126 >  Form1: TForm1;
127 >
128 > implementation
129 >
130 > {$R *.lfm}
131 >
132 > uses IB, Unit2;
133 >
134 > function ExtractDBException(msg: string): string;
135 > var Lines: TStringList;
136 > begin
137 >     Lines := TStringList.Create;
138 >     try
139 >       Lines.Text := msg;
140 >       if pos('exception',Lines[0]) = 1 then
141 >         Result := Lines[2]
142 >       else
143 >         Result := msg
144 >     finally
145 >       Lines.Free
146 >     end;
147 > end;
148 >
149 > { TForm1 }
150 >
151 > procedure TForm1.EmployeesSALARYGetText(Sender: TField; var aText: string;
152 >  DisplayText: Boolean);
153 > begin
154 >  if DisplayText then
155 >  begin
156 >    if Sender.IsNUll then
157 >      aText := ''
158 >    else
159 >      aText := FormatFloat('$#,##0.00',Sender.AsFloat)
160 >  end
161 >  else
162 >    aText := Sender.AsString
163 > end;
164 >
165 > procedure TForm1.JobCodesBeforeOpen(DataSet: TDataSet);
166 > begin
167 >  JobCodes.ParamByName('JOB_GRADE').AsInteger := EmployeesJOB_GRADE.AsInteger;
168 >  JobCodes.ParamByName('JOB_COUNTRY').AsString := EmployeesJOB_COUNTRY.AsString
169 > end;
170 >
171 > procedure TForm1.SaveChangesExecute(Sender: TObject);
172 > begin
173 >  Employees.Transaction.Commit
174 > end;
175 >
176 > procedure TForm1.SaveChangesUpdate(Sender: TObject);
177 > begin
178 >  (Sender as TAction).Enabled := FDirty
179 > end;
180 >
181 > procedure TForm1.Reopen(Data: PtrInt);
182 > begin
183 >  with IBTransaction1 do
184 >    if not InTransaction then StartTransaction;
185 >  Countries.Active := true;
186 >  Employees.Active := true;
187 >  JobCodes.Active := true;
188 >  Depts.Active := true;
189 > end;
190 >
191 > procedure TForm1.AddEmployeeExecute(Sender: TObject);
192 > begin
193 >  Employees.Append
194 > end;
195 >
196 > procedure TForm1.SelectDeptExecute(Sender: TObject);
197 > var Dept_No: string;
198 > begin
199 >  if SelectDeptDlg.ShowModal(EmployeesDEPT_KEY_PATH.AsString,Dept_No) = mrOK then
200 >  begin
201 >    Employees.Edit;
202 >    EmployeesDEPT_NO.AsString := Dept_No;
203 >    try
204 >      Employees.Post;
205 >    except
206 >      Employees.Cancel;
207 >      raise;
208 >    end;
209 >    IBDynamicGrid1.ShowEditorPanel;
210 >  end;
211 > end;
212 >
213 > procedure TForm1.EmployeesAfterPost(DataSet: TDataSet);
214 > begin
215 >  Employees.Refresh
216 > end;
217 >
218 > procedure TForm1.JobGradeDBComboBoxCloseUp(Sender: TObject);
219 > begin
220 >  JobGradeDBComboBox.EditingDone; //See http://bugs.freepascal.org/view.php?id=27186
221 > end;
222 >
223 > procedure TForm1.BeforeDateChange(Sender: TObject);
224 > begin
225 >  Employees.Active := false;
226 >  Employees.Active := true
227 > end;
228 >
229 > procedure TForm1.CancelChangesExecute(Sender: TObject);
230 > begin
231 >  Employees.Transaction.Rollback
232 > end;
233 >
234 > procedure TForm1.CountriesBeforeOpen(DataSet: TDataSet);
235 > begin
236 >  Countries.ParamByName('JOB_GRADE').AsInteger := EmployeesJOB_GRADE.AsInteger;
237 >  Countries.ParamByName('JOB_CODE').AsString := EmployeesJOB_CODE.AsString
238 > end;
239 >
240 > procedure TForm1.DeleteEmployeeExecute(Sender: TObject);
241 > begin
242 >  if MessageDlg(
243 >    Format('Remove %s from Employee List?',[Employees.FieldByName('Full_Name').AsString]),
244 >    mtConfirmation,[mbYes,mbNo],0) = mrYes then
245 >    Employees.Delete
246 > end;
247 >
248 > procedure TForm1.EditEmployeeExecute(Sender: TObject);
249 > begin
250 >  IBDynamicGrid1.ShowEditorPanel;
251 > end;
252 >
253 > procedure TForm1.EditEmployeeUpdate(Sender: TObject);
254 > begin
255 >  (Sender as TAction).Enabled := Employees.Active and (Employees.RecordCount > 0)
256 > end;
257 >
258 > procedure TForm1.EmployeesAfterInsert(DataSet: TDataSet);
259 > begin
260 >  EmployeesJOB_COUNTRY.AsString := 'USA';
261 >  EmployeesJOB_CODE.AsString := 'SRep';
262 >  EmployeesJOB_GRADE.AsInteger := 4;
263 >  EmployeesSALARY.AsCurrency := 20000;
264 >  EmployeesFIRST_NAME.AsString := '<no name>';
265 >  EmployeesLAST_NAME.AsString := '<no name>';
266 >  EmployeesHIRE_DATE.AsDateTime := now;
267 >  EmployeesDEPT_NO.AsString := '000';
268 >  FDirty := true;
269 > end;
270 >
271 > procedure TForm1.EmployeesAfterOpen(DataSet: TDataSet);
272 > begin
273 >  TotalsQuery.Active := true
274 > end;
275 >
276 > procedure TForm1.EmployeesAfterScroll(DataSet: TDataSet);
277 > begin
278 >  Countries.Active := false;
279 >  JobCodes.Active := false;
280 >  Countries.Active := true;
281 >  JobCodes.Active := true;
282 > end;
283 >
284 > procedure TForm1.EmployeesBeforeClose(DataSet: TDataSet);
285 > begin
286 >  with DataSet do
287 >    if State in [dsInsert,dsEdit] then
288 >    try
289 >     Post;
290 >    except
291 >      Cancel;
292 >      raise;
293 >    end;
294 >  TotalsQuery.Active := false
295 > end;
296 >
297 > procedure TForm1.EmployeesBeforeOpen(DataSet: TDataSet);
298 > begin
299 >  if BeforeDate.Date > 0 then
300 >     (DataSet as TIBParserDataSet).Parser.Add2WhereClause('HIRE_DATE < :BeforeDate');
301 >  if AfterDate.Date > 0 then
302 >     (DataSet as TIBParserDataSet).Parser.Add2WhereClause('HIRE_DATE > :AfterDate');
303 >
304 >  case SalaryRange.ItemIndex of
305 >  1:
306 >    (DataSet as TIBParserDataSet).Parser.Add2WhereClause('Salary < 40000');
307 >  2:
308 >    (DataSet as TIBParserDataSet).Parser.Add2WhereClause('Salary >= 40000 and Salary < 100000');
309 >  3:
310 >    (DataSet as TIBParserDataSet).Parser.Add2WhereClause('Salary >= 100000');
311 >  end;
312 >
313 >
314 >
315 >  {Parameter value must be set after all SQL changes have been made}
316 >  if BeforeDate.Date > 0 then
317 >     (DataSet as TIBParserDataSet).ParamByName('BeforeDate').AsDateTime := BeforeDate.Date;
318 >  if AfterDate.Date > 0 then
319 >   (DataSet as TIBParserDataSet).ParamByName('AfterDate').AsDateTime := AfterDate.Date;
320 >
321 > end;
322 >
323 > procedure TForm1.EmployeesJOB_CODEChange(Sender: TField);
324 > begin
325 >  Countries.Active := false;
326 >  Countries.Active := true;
327 > end;
328 >
329 > procedure TForm1.EmployeesJOB_GRADEChange(Sender: TField);
330 > begin
331 >  Countries.Active := false;
332 >  JobCodes.Active := false;
333 >  Countries.Active := true;
334 >  JobCodes.Active := true;
335 > end;
336 >
337 > procedure TForm1.FormClose(Sender: TObject; var CloseAction: TCloseAction);
338 > begin
339 >  FClosing := true;
340 >  if IBTransaction1.InTransaction then
341 >    IBTransaction1.Commit;
342 > end;
343 >
344 > procedure TForm1.FormShow(Sender: TObject);
345 > begin
346 >  repeat
347 >    try
348 >      IBDatabase1.Connected := true;
349 >    except
350 >     on E:EIBClientError do
351 >      begin
352 >        Close;
353 >        Exit
354 >      end;
355 >    On E:Exception do
356 >     MessageDlg(E.Message,mtError,[mbOK],0);
357 >    end;
358 >  until IBDatabase1.Connected;
359 >  Reopen(0);
360 > end;
361 >
362 > procedure TForm1.EmployeesAfterDelete(DataSet: TDataSet);
363 > begin
364 >  FDirty := true
365 > end;
366 >
367 > procedure TForm1.EmployeesAfterTransactionEnd(Sender: TObject);
368 > begin
369 >  FDirty := false;
370 >  if not FClosing then
371 >    Application.QueueAsyncCall(@Reopen,0)
372 > end;
373 >
374 > procedure TForm1.EmployeesPostError(DataSet: TDataSet; E: EDatabaseError;
375 >  var DataAction: TDataAction);
376 > begin
377 >  if E is EIBError then
378 >   begin
379 >       MessageDlg(ExtractDBException(EIBError(E).message),mtError,[mbOK],0);
380 >       DataSet.Cancel;
381 >       DataAction  := daAbort
382 >   end;
383 > end;
384 >
385 > end.
386 >

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines