var
x : Integer;
y : Integer;
zStand : Integer;
begin
//------------------------------------------------------------------------------
//Zählerstand darf nicht Leer sein!
//------------------------------------------------------------------------------
begin
if (LbE_Zaehler.Text='') then
begin
ShowMessage('Bitte Zählerstand Eintragen.');
end;
end;
//------------------------------------------------------------------------------
// ComboBox mit namen Darf nicht Frei Sein!
//------------------------------------------------------------------------------
begin
if (CbB_Name.Text='') then
begin
ShowMessage('Bitte Namen Auswählen.');
end;
end;
//------------------------------------------------------------------------------
//
SQL Table füllen (DBGrid)
//------------------------------------------------------------------------------
begin
with DB_Query_Eintragen do
begin
Application.ProcessMessages;
Close;
SQL.Clear;
SQL.Text:='select * from daten';
ExecSQL;
Active:=True;
Edit;
Last;
zStand:=FieldByName('Stand').AsInteger;
Append;
//FieldByName('Stand').AsInteger:=FieldByName('Neu').AsInteger;
FieldByName('Datum').AsDateTime:=Date;
FieldByName('Zeit').AsString:=TimeToStr(Time);
FieldByName('Name').AsString:=CbB_Name.Text;
DB_Query_Eintragen.FieldByName('Stand').AsVariant:=0;
x:=StrToInt(LbE_Zaehler.Text);
FieldByName('Neu').AsVariant:=(x);
y:=x-zStand;
FieldByName('Neu').AsVariant:=StrToInt(LbE_Zaehler.Text);
FieldByName('Verbrauch').AsVariant:=IntToStr(y);
Post;
Table_Daten.Refresh;
Close;
end;
end;
end;