S
sqwc
Unregistered / Unconfirmed
GUEST, unregistred user!
用Oracle7.3做数据库,Delphi4做前端工具时,
使用Query1做dataset,利用了updatesql,database,除以下设置及数据库别名及口令外,其他属性都采用缺省值,运行后发现只能增加,删除修改记录时出现 "update failed"错误信息,请指教!!!Thanks!
设置如下:
Object query1:Tquery1
cachedupdated=true
updateobject=updatesql1
end
//按button2后出现 "update failed"错误信息
procedure TForm1.Button2Click(Sender: TObject);
begin
with Query1 do
begin
Database1.StartTransaction;
try
ApplyUpdates; {try to write the updates to the database};
Database1.Commit; {on success, commit the changes};
except
Database1.Rollback; {on failure, undo the changes};
raise; {raise the exception to prevent a call to CommitUpdates!}
end;
CommitUpdates; {on success, clear the cache}
end;
end;
procedure TForm1.Query1UpdateRecord(DataSet: TDataSet;
UpdateKind: TUpdateKind; var UpdateAction: TUpdateAction);
begin
//updatekink:=ukmodify;
UpdateSQL1.Apply(UpdateKind);
dataset:=query1;
UpdateAction := uaApplied;
end;
使用Query1做dataset,利用了updatesql,database,除以下设置及数据库别名及口令外,其他属性都采用缺省值,运行后发现只能增加,删除修改记录时出现 "update failed"错误信息,请指教!!!Thanks!
设置如下:
Object query1:Tquery1
cachedupdated=true
updateobject=updatesql1
end
//按button2后出现 "update failed"错误信息
procedure TForm1.Button2Click(Sender: TObject);
begin
with Query1 do
begin
Database1.StartTransaction;
try
ApplyUpdates; {try to write the updates to the database};
Database1.Commit; {on success, commit the changes};
except
Database1.Rollback; {on failure, undo the changes};
raise; {raise the exception to prevent a call to CommitUpdates!}
end;
CommitUpdates; {on success, clear the cache}
end;
end;
procedure TForm1.Query1UpdateRecord(DataSet: TDataSet;
UpdateKind: TUpdateKind; var UpdateAction: TUpdateAction);
begin
//updatekink:=ukmodify;
UpdateSQL1.Apply(UpdateKind);
dataset:=query1;
UpdateAction := uaApplied;
end;