S
saith
Unregistered / Unconfirmed
GUEST, unregistred user!
谁来帮忙解决,保存主从表之前需要进行主关键字的修改,从表需要循环修改关键字,出现错误. 代码如下:<br> //---更新从表<br> First;<br> while not Eof do<br> begin<br> if LowerCase(Trim(FieldByName(dbedt_SubMainKey.DataField).AsString)) <> LowerCase(Trim(Bill_Number)) then<br> begin<br> EditDataSet(dbedt_SubMainKey.DataSource.DataSet);<br> FieldByName(dbedt_SubMainKey.DataField).AsString:= Bill_Number;<br> end;<br> Next;<br> end;<br>-------------------------------------<br> with dbedt_MainKey.DataSource.DataSet do<br> begin<br> EditDataSet(dbedt_MainKey.DataSource.DataSet);<br> if glb_DataSet.FieldByName('Main_IsNew').AsBoolean then<br> dbedt_MainKey.Field.AsString:= Bill_Number;<br> end;<br><br>----<br>错误提示:Can not use Master/Detail with CachedUpdates (D:/Projects/Delphi/Dac/Source/DBAccess.pas, line 3195)<br>执行到 First是就会出现此错误提示