H
hxantman
Unregistered / Unconfirmed
GUEST, unregistred user!
环境:windows 2000 pro 数据库也安装上面
数据库:DB2 7.2
delphi5 用bde连接数据库
Database1+query1+datasource1+updatasql1
问题:起用程序,对连接的数据表进行编辑,运行post操作,一切正常,当再次对数据表进行编辑后,运行post操作,就出错了,跟踪一下,发现是运行在ApplyUpdates出错,提示gernale sql error.我做了很多实验,同样的操作在sql server 和oracle上是没问题,请各位老大指点啊。
procedure TForm1.Query1AfterPost(DataSet: TDataSet);
begin
with Query1 do begin
Database1.StartTransaction;
try
//Showmessage(Sql.Text);
ApplyUpdates;
Database1.Commit;
except
on E: Exception do begin
Showmessage(E.Message + inttostr(E.HelpContext));
Database1.Rollback;
// on E: Exception do showmessage(E.Message+ inttostr(E.HelpContext));
raise;
end;
end;
// CommitUpdates;
end;
end;
update huxtest
set
CLASS_ID = :CLASS_ID,
CLASS_NAME = :CLASS_NAME,
DEPARTMENT_ID = EPARTMENT_ID,
SECTION = :SECTION
where
CLASS_ID = :OLD_CLASS_ID
insert into huxtest
(CLASS_ID, CLASS_NAME, DEPARTMENT_ID, SECTION)
values
CLASS_ID, :CLASS_NAME, EPARTMENT_ID, :SECTION)
数据库:DB2 7.2
delphi5 用bde连接数据库
Database1+query1+datasource1+updatasql1
问题:起用程序,对连接的数据表进行编辑,运行post操作,一切正常,当再次对数据表进行编辑后,运行post操作,就出错了,跟踪一下,发现是运行在ApplyUpdates出错,提示gernale sql error.我做了很多实验,同样的操作在sql server 和oracle上是没问题,请各位老大指点啊。
procedure TForm1.Query1AfterPost(DataSet: TDataSet);
begin
with Query1 do begin
Database1.StartTransaction;
try
//Showmessage(Sql.Text);
ApplyUpdates;
Database1.Commit;
except
on E: Exception do begin
Showmessage(E.Message + inttostr(E.HelpContext));
Database1.Rollback;
// on E: Exception do showmessage(E.Message+ inttostr(E.HelpContext));
raise;
end;
end;
// CommitUpdates;
end;
end;
update huxtest
set
CLASS_ID = :CLASS_ID,
CLASS_NAME = :CLASS_NAME,
DEPARTMENT_ID = EPARTMENT_ID,
SECTION = :SECTION
where
CLASS_ID = :OLD_CLASS_ID
insert into huxtest
(CLASS_ID, CLASS_NAME, DEPARTMENT_ID, SECTION)
values
CLASS_ID, :CLASS_NAME, EPARTMENT_ID, :SECTION)