procedure
TEdit_Office
.
add_officeClick(Sender: TObject);
var
curs:
integer
;
begin
try
with
DataModule1
.
IBQuery2
do
begin
SQL
.
Text:=
'UPDATE office SET o_name = :o_name WHERE o_id = :o_id'
;
ParamByName (
'o_name'
).AsString:=Edit1
.
Text;
ParamByName (
'o_id'
).Value := DataModule1
.
office
.
FieldByName(
'o_id'
).AsString;
DataModule1
.
DataSource1
.
DataSet
.
RecNo:= curs;
curs:= DataModule1
.
office
.
FieldByName(
'o_id'
).AsInteger;
Transaction
.
StartTransaction;
ExecSQL;
Transaction
.
Commit;
Transaction
.
Active:=
false
;
end
;
DataModule1
.
OFFICE
.
Close;
DataModule1
.
OFFICE
.
Open;
DataModule1
.
DataSource1
.
DataSet
.
Locate(
'o_id'
, IntToStr (curs), []);
except
on
E: Exception
do
begin
if
DataModule1
.
IBQuery2
.
Active
then
DataModule1
.
IBQuery2
.
Transaction
.
Rollback;
Application
.
MessageBox(
PChar
(E
.
Message),
'Îøèáêà'
, MB_ICONERROR);
end
;
end
;
Edit_Office
.
close;
end
;