procedure
TMainForm
.
Button1Click(Sender: TObject);
var
path:
string
;
ITOG:
integer
;
begin
path := ExtractFilePath(paramstr(
0
)) +
'BD.mdb'
;
ADOTable1
.
Active :=
False
;
ADOConnection1
.
Connected :=
False
;
ADOConnection1
.
ConnectionString:=
'Provider=Microsoft.Jet.OLEDB.4.0;Data Source='
+path+
';Persist Security Info=False;'
;
ADOConnection1
.
Connected:=
true
;
ADOTable1
.
TableName :=
'base'
;
ADOTable1
.
Active :=
True
;
ITOG :=
0
;
while
not
ADOTable1
.
Eof
do
begin
ITOG := ITOG + ADOTable1
.
Fields[
4
].AsInteger;
ADOTable1
.
Next;
end
;
edITOG
.
Text := IntToStr(ITOG);
end
;
procedure
TMainForm
.
Button2Click(Sender: TObject);
var
path:
string
;
begin
path := ExtractFilePath(paramstr(
0
)) +
'BD.mdb'
;
ADOQuery1
.
Active :=
False
;
ADOQuery1
.
Close;
ADOConnection1
.
Connected:=
false
;
ADOConnection1
.
ConnectionString:=
'Provider=Microsoft.Jet.OLEDB.4.0;Data Source='
+path+
';Persist Security Info=False;'
;
ADOConnection1
.
Connected:=
true
;
ADOQuery1
.
SQL
.
Clear;
ADOQuery1
.
SQL
.
Text:=
'SELECT SUM(value4) FROM base'
;
ADOQuery1
.
Open;
ADOQuery1
.
Active:=
true
;
edITOG
.
Text := ADOQuery1
.
Fields[
0
].AsString;
end
;