171 |
|
|
172 |
|
{$R *.lfm} |
173 |
|
|
174 |
< |
uses IB, Unit2; |
174 |
> |
uses IB, Unit2, FBMessages; |
175 |
|
|
176 |
|
const |
177 |
|
sNoName = '<no name>'; |
178 |
|
|
179 |
– |
function ExtractDBException(msg: string): string; |
180 |
– |
var Lines: TStringList; |
181 |
– |
begin |
182 |
– |
Lines := TStringList.Create; |
183 |
– |
try |
184 |
– |
Lines.Text := msg; |
185 |
– |
if pos('exception',Lines[0]) = 1 then |
186 |
– |
Result := Lines[2] |
187 |
– |
else |
188 |
– |
Result := msg |
189 |
– |
finally |
190 |
– |
Lines.Free |
191 |
– |
end; |
192 |
– |
end; |
193 |
– |
|
179 |
|
{ TForm1 } |
180 |
|
|
181 |
|
procedure TForm1.EmployeesSALARYGetText(Sender: TField; var aText: string; |
213 |
|
with IBTransaction1 do |
214 |
|
if not InTransaction then StartTransaction; |
215 |
|
Countries.Active := true; |
216 |
+ |
Employees.EnableStatistics := true; |
217 |
|
Employees.Active := true; |
218 |
|
JobCodes.Active := true; |
219 |
|
Depts.Active := true; |
340 |
|
if AfterDate.Date > 0 then |
341 |
|
(DataSet as TIBParserDataSet).Parser.Add2WhereClause('HIRE_DATE > :AfterDate'); |
342 |
|
|
343 |
+ |
|
344 |
|
case SalaryRange.ItemIndex of |
345 |
|
1: |
346 |
|
(DataSet as TIBParserDataSet).Parser.Add2WhereClause('Salary < 40000'); |
379 |
|
|
380 |
|
procedure TForm1.FormShow(Sender: TObject); |
381 |
|
begin |
382 |
+ |
{Set IB Exceptions to only show text message - omit SQLCode and Engine Code} |
383 |
+ |
FirebirdAPI.GetStatus.SetIBDataBaseErrorMessages([ShowIBMessage]); |
384 |
+ |
Application.ExceptionDialog := aedOkMessageBox; |
385 |
|
repeat |
386 |
|
try |
387 |
|
IBDatabase1.Connected := true; |
415 |
|
begin |
416 |
|
if E is EIBError then |
417 |
|
begin |
418 |
< |
MessageDlg(ExtractDBException(EIBError(E).message),mtError,[mbOK],0); |
418 |
> |
MessageDlg(EIBError(E).message,mtError,[mbOK],0); |
419 |
|
DataSet.Cancel; |
420 |
|
DataAction := daAbort |
421 |
|
end; |