unit Unit1;
interface
uses
SysUtils, Windows, Messages, Classes, Graphics, Controls,
StdCtrls, Forms, DBCtrls,
DB, ExtCtrls, Mask, DBTables, Dialogs,
IBCustomDataSet, IBQuery, IBDatabase, IBStoredProc, Grids, DBGrids;
type
TForm1 =
class(TForm)
IBDatabase1: TIBDatabase;
IBQuery1: TIBQuery;
IBTransaction1: TIBTransaction;
DataSource1: TDataSource;
IBStoredProc1: TIBStoredProc;
IBStoredProc2: TIBStoredProc;
IBStoredProc3: TIBStoredProc;
IBQuery2: TIBQuery;
DBNavigator1: TDBNavigator;
Artikelnummer: TDBEdit;
Artikel: TDBEdit;
Artikelpreis: TDBEdit;
Lager: TDBEdit;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
Button6: TButton;
DBGrid1: TDBGrid;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
procedure FormCreate(Sender: TObject);
procedure refresh(Sender: TObject);
procedure sperren(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
//procedure Button3Click(Sender: TObject);
//procedure Button4Click(Sender: TObject);
procedure zaehlen(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
IBQuery1.Open;
end;
procedure refresh(Sender: TObject);
Var
bm : TBookMark;
begin
With IBQuery1
Do
Begin
bm := GetBookmark;
Active := False;
Active := True;
GotoBookmark(bm);
FreeBookmark(bm);
End;
end;
procedure sperren(Sender: TObject);
Var
t1 :
String;
begin
t1 := Artikelnummer..Text;
try
IBQuery1.Active := False;
IBTransaction1.Active := True;
with IBStoredProc1
do
begin
Prepare;
Params.ParamByName('
PAR_Nummer').AsString := t1;
ExecProc;
end;
IBTransaction1.Commit;
except
IBTransaction1.Rollback;
MessageDlg('
Satz gesperrt!',mtWarning,[mbOK],0);
End;
Button1Click(Sender);
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
Form2.Edit1.Text := '
';
Form2.Edit2.Text := '
';
Form2.Edit3.Text := '
';
Form2.Edit4.Text := '
';
If Form2.ShowModal = mrOK
Then
Begin
IBTransaction1.Active := True;
with IBStoredProc2
do
begin
Prepare;
Params.ParamByName('
PAR_Nummer').AsString := Form2.Edit1.Text;
Params.ParamByName('
PAR_Artikel').AsString := Form2.Edit2.Text;
Params.ParamByName('
PAR_Preis').AsString := Form2.Edit3.Text;
Params.ParamByName('
PAR_Lager').AsString := Form2.Edit3.Text;
ExecProc;
end;
Button1Click(Sender);
IBQuery1.Locate('
Name;Vorname',VarArrayOf([Form2.Edit1.Text,Form2.Edit2.Text]),[loCaseInsensitive]);
End;
end;
{procedure zaehlen(Sender: TObject);
Var
t : String;
begin
Query2.Active := True;
t := Query2.Fields[0].AsString;
MessageDlg('Anzahl Sätze: ' + t,mtInformation,[mbOK],0);
Query2.Active := False;
end;
}
procedure TForm1.Button6Click(Sender: TObject);
begin
close;
end;
end.