M
machinxing
Unregistered / Unconfirmed
GUEST, unregistred user!
我的系统若开始先点查询,就可以查到单据表里的所有内容,系统正常运行.但是如果我先执行了单据表的结账模块,之后再进入查询,当点击查询按钮时就会出现cannot perform this operation on a closed dataset!我用单步执行时过程如下先执行结账模块之后,进入单据查询窗体...我的查询模块:procedure TfrmSearchInfo.BitBtn3Click(Sender: TObject);begin DM.qryOrderDishes.Close; //单据表 <----------------------------------------------单步执行开始跳转位置 DM.qryOrderDishes.SQL.Clear; DM.qryOrderDishes.SQL.Add('SELECT * FROM OrderDishes');//查询所有 DM.qryOrderDishes.SQL.Add('WHERE 0=0'); if edtOrderDishesID.Text <> '' then DM.qryOrderDishes.SQL.Add(' AND OrderDishesID LIKE ' + QuotedStr('%'+ edtOrderDishesID.Text +'%')); if edtDiningTableID.Text <> '' then DM.qryOrderDishes.SQL.Add(' AND DiningTableID LIKE ' + QuotedStr('%'+ edtDiningTableID.Text +'%')); if edtCustomer.Text <> '' then DM.qryOrderDishes.SQL.Add(' AND Customer LIKE ' + QuotedStr('%'+ edtCustomer.Text +'%')); DM.qryOrderDishes.Open; DM.qryOrderDishes.First;end;我的结账模块中当输入用餐金额计算折扣金额的代码rocedure TfrmDiningBalance.edtTotalsMoenyChange(Sender: TObject);begin <-----------------------------------------------------------------单步执行跳转到这里! DM.qryVIP.Close; //会员表 DM.qryVIP.SQL.Clear; DM.qryVIP.SQL.Add('SELECT * FROM VIP'); DM.qryVIP.SQL.Add('WHERE 0=0'); DM.qryVIP.Open; DM.qryOrderDishes.Edit ; //单据表编辑<---------------------------单步执行到这里后出现错误信息 if edtTotalsMoeny.Text <> '' then //当输入用餐金额不为空时 DM.qryOrderDishes.FieldByName('RebateMoney').AsString := FloatToStrStrToFloatedtTotalsMoeny.Text) * DM.qryVIP.FieldByName('Discount1').AsFloat); //执行折扣金额=用餐金额*折扣率(会员表内容)end;感觉像是执行到edit,但查询窗口不允许执行edit操作,所以提示出错.但是为什么程序会发生这样的跳转? 请大虾们不吝赐教!万分感谢!