各位老大,我的源码如下:
procedure TEditOrdersForm.InsertBtnClick(Sender: TObject);{此EditOrdersForm为模态窗口}
begin
if Navigator.DataSource=MastData.OrdersSrc then {用Navigator来判断当前激活哪张表,Order/Items为主/细表,Items.Mastsource=Orders,Items.MastFields=OrderNo}
DataMod.Orders.Insert {这一步可以执行,且主/细表同时插入}
else if
Navigator.DataSource=DataMod.ItemsSrc{在同一OrderNo时插入多个Items记录}
then
begin
DataMod.Items.open;
DataMod.Items.edit;{到此步执行正常,并在DbGrid中能看到当前记录处于"I"状态}
DataMod.Items.Insert;{出现"Items not in edit or insert state"错误}
end;
end;
请各位老大详加指点,小生感谢不尽!