home *** CD-ROM | disk | FTP | other *** search
- unit sSharedIB;
-
- interface
-
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, IBQuery, db;
-
- type
- TSharedIBForm = class(TForm)
- private
- { Private declarations }
- public
- { Public declarations }
- end;
-
- var
- SharedIBForm: TSharedIBForm;
-
- procedure SelectIBQuery(Query:TIBQuery; Par:string); //┬√∩εδφσφΦσ τα∩≡ε±α SQL
- procedure ExecuteIBQuery(Query:TIBQuery; Par:string); //┬√∩εδφσφΦσ Ωε∞αφΣ√ SQL
- function GetMaxIBFieldValue(Query:TIBQuery; TableName, FieldName:string):integer;
- function GetFirstField(Query:TIBQuery; Par:string): TField;
-
- implementation
-
- {$R *.DFM}
-
- procedure SelectIBQuery(Query:TIBQuery; Par:string);
- begin
- Query.DisableControls;
- Query.Close;
- Query.SQL.Text:=Par;
- try begin
- Query.Open;
- end
- except on E: Exception do begin
- MessageDlg('╬°ΦßΩα ∩≡Φ Γ√∩εδφσφΦΦ τα∩≡ε±α (' + E.Message + ') : "'+Query.SQL.Text+'".', mtError, [mbOK], 0);
- end;
- end;
- Query.EnableControls;
- end;
-
- procedure ExecuteIBQuery(Query:TIBQuery; Par:string);
- begin
- Query.Close;
- Query.SQL.Text:=Par;
- try begin
- Query.ExecSQL;
- end
- except on E: Exception do begin
- MessageDlg('╬°ΦßΩα ∩≡Φ Γ√∩εδφσφΦΦ τα∩≡ε±α (' + E.Message + ') : "'+Query.SQL.Text+'".', mtError, [mbOK], 0);
- end;
- end;
- end;
-
- function GetMaxIBFieldValue(Query:TIBQuery; TableName, FieldName:string):integer;
- begin
- SelectIBQuery(Query, 'select max('+FieldName+') from '+TableName+';');
- GetMaxIBFieldValue:=Query.Fields[0].asInteger;
- end;
-
- function GetFirstField(Query:TIBQuery; Par:string): TField;
- begin
- SelectIBQuery(Query, Par);
- Result := Query.Fields[0];
- end;
-
- end.
-
-
-