if application.MessageBox('真的要将费用帐进行确认存储吗?','系统操作提示:', mb_okcancel+mb_iconquestion)=1 then
   begin
         //数据插入到住院病人药品划价表zy_xy_hj
      ADOQueryzy_xy_hj.open;
      ADOQueryzy_xy_hj.append;
      ADOQueryzy_xy_hj.edit;
      ADOQueryzy_xy_hj.fieldbyname('code').asstring:=zycode;   //住院号
      ADOQueryzy_xy_hj.FieldByName('fycode').asstring:=editfycode.text;    //处方号
      ADOQueryzy_xy_hj.fieldbyname('fydoctor').asstring:=edt_doctor.text;//开单医生
      ADOQueryzy_xy_hj.fieldbyname('fydepa').asstring:=editdepa.text;      //医生所属科室
      ADOQueryzy_xy_hj.fieldbyname('pym').asstring:=ADOQuerydata_yp_x.fieldbyname('pym').asstring;
      ADOQueryzy_xy_hj.fieldbyname('ypcode').asstring:=ADOQuerydata_yp_x.fieldbyname('code').asstring;  //药品编码
      ADOQueryzy_xy_hj.fieldbyname('fyname').asstring:=ADOQuerydata_yp_x.fieldbyname('name').asstring;   //西药名称
      ADOQueryzy_xy_hj.fieldbyname('ypgg').asstring:=ADOQuerydata_yp_x.fieldbyname('gg').asstring;
      ADOQueryzy_xy_hj.FieldByName('fyprice').asstring:=editprice.text;    //药品单价
      ADOQueryzy_xy_hj.FieldByName('fynum').asstring:=editnum.text;        //药品数量
      ADOQueryzy_xy_hj.FieldByName('fybigtype').asstring:=ADOQuerydata_yp_x.fieldbyname('bigtype').asstring;   //西药所属药品大类(西药大类)
      ADOQueryzy_xy_hj.FieldByName('jzman').asstring:=landname;   //发药员
      ADOQueryzy_xy_hj.FieldByName('fydate').asdatetime:=GetSysTime();     //发药时间
      ADOQueryzy_xy_hj.fieldbyname('xzflag').asstring:=ADOQuerydata_yp_x.fieldbyname('yp_style').asstring; ;   //西、中成药、中草药
      ADOQueryzy_xy_hj.fieldbyname('fy_flag').asstring:='0';   //0划价未发药、1已发药
      ADOQueryzy_xy_hj.fieldbyname('cf_type').asstring:=trim(edt_cftype.Text);   //1普通、2公费、3其他
      ADOQueryzy_xy_hj.fieldbyname('fyfs').asstring:='1'; //中药发药付数 -- 缺省为1付;西药发药时只能为1
      ADOQueryzy_xy_hj.fieldbyname('depa').asstring:=depa_flag;
      ADOQueryzy_xy_hj.fieldbyname('yp_style').asstring:=ADOQuerydata_yp_x.fieldbyname('yp_style').asstring;
      ADOQueryzy_xy_hj.post;
      ADOQueryzy_xy_hj.UpdateBatch;
        adp_GetYphjfee.Close;
      adp_GetYphjfee.Parameters.ParamValues['@depa']:=depa_flag;
      adp_GetYphjfee.Parameters.ParamValues['@cfcode']:=trim(editfycode.text);
      adp_GetYphjfee.Parameters.ParamValues['@flag']:='1';
      adp_GetYphjfee.Prepared;
      adp_GetYphjfee.ExecProc;
      sum:=adp_GetYphjfee.Parameters.ParamValues['@dfprice'];
      zysum:=adp_GetYphjfee.Parameters.ParamValues['@sumfee'];
      dwfee:=adp_GetYphjfee.Parameters.ParamValues['@dwprice'];
      adp_GetYphjfee.Close;
      
      label17.caption:='药品种数:'+inttostr(ADOQueryzy_xy_hj.RecordCount);
   end;
运行后保存数据时出现两个错误:
1、参数类型不正确,或不在可以接受的范围之内,或与其他参数冲突。
2、为过程或函数pr_GetYphj_fee指定的参数太多
请高手指点,谢谢!!

解决方案 »

  1.   

    1、参数类型不正确,或不在可以接受的范围之内,或与其他参数冲突。
    这个问题一般是因为所付的值类型和字段类型不一致,比如给数值型字段赋值字符串
    2、为过程或函数pr_GetYphj_fee指定的参数太多
    检查是不是参数太多了,没有的又给人家赋值了
      

  2.   

    我贴出储存过程给各位高手看看:
    CREATE procedure pr_GetYphj_fee  
    @depa char(2) ,
    @cfcode varchar(20) ,
    @flag char(1) ,/*0门诊处方划价、1住院处方划价*/
    @dfprice money output ,/*单付价格*/
    @sumfee money output  /*药品总价--四舍五入*/
    as 
    begin
       set nocount on 
       declare  @zyfee money , @xyfee money  ,@zlfee money
       declare      @xyf01          money   ,       @zyf20          money    ,@zyf21                money
       declare      @wc30           money ,       @dzyh31         money    if @flag='1'  /*住院处方划价的药品总价*/
       begin
          select @dfprice=isnull(sum(isnull(fyprice,0)*isnull(fynum,0)),0) from zy_xy_hj 
          where  depa=@depa
            and  fycode=@cfcode       select @xyf01=round(isnull(sum(isnull(fyprice,0)*isnull(fynum,0)*isnull(fyfs,1)),0),1) from zy_xy_hj /*西药费--四舍五入到角*/
          where  depa=@depa
            and  fycode=@cfcode 
            and  xzflag in ('01') 
          select @zyf20=round(isnull(sum(isnull(fyprice,0)*isnull(fynum,0)*isnull(fyfs,1)),0),1) from zy_xy_hj /*中成药费--四舍五入到角*/
          where  depa=@depa
            and  fycode=@cfcode 
            and  xzflag in ('20') 
          select @zyf21=round(isnull(sum(isnull(fyprice,0)*isnull(fynum,0)*isnull(fyfs,1)),0),1) from zy_xy_hj /*中草药费--四舍五入到角*/
          where  depa=@depa
            and  fycode=@cfcode 
            and  xzflag in ('21') 
          select @wc30=round(isnull(sum(isnull(fyprice,0)*isnull(fynum,0)*isnull(fyfs,1)),0),1) from zy_xy_hj /*卫生材料费--四舍五入到角*/
          where  depa=@depa
            and  fycode=@cfcode 
            and  xzflag in ('30')       select @dzyh31=round(isnull(sum(isnull(fyprice,0)*isnull(fynum,0)),0),1) from zy_xy_hj /*低值易耗费--四舍五入到角*/
          where  depa=@depa
            and  fycode=@cfcode 
            and  xzflag not in ('01','20','21','30')       select @sumfee = @xyf01 + @zyf20 + @zyf21 + @wc30 + @dzyh31 
       end 
       if @flag='3'  /*住院处方退药的药品总价*/
       begin
          select @xyf01=round(isnull(sum(isnull(fyprice,0)*isnull(ty_num,0)),0),1) from zy_ypout_x /*中药费--四舍五入到角*/
          where  depa=@depa
            and  fycode=@cfcode 
            and  xzflag in ('01') 
          select @zyf20=round(isnull(sum(isnull(fyprice,0)*isnull(ty_num,0)),0),1) from zy_ypout_x /*中药费--四舍五入到角*/
          where  depa=@depa
            and  fycode=@cfcode 
            and  xzflag in ('20') 
          select @zyf21=round(isnull(sum(isnull(fyprice,0)*isnull(ty_num,0)),0),1) from zy_ypout_x /*中药费--四舍五入到角*/
          where  depa=@depa
            and  fycode=@cfcode 
            and  xzflag in ('21') 
          select @wc30=round(isnull(sum(isnull(fyprice,0)*isnull(ty_num,0)),0),1) from zy_ypout_x /*中药费--四舍五入到角*/
          where  depa=@depa
            and  fycode=@cfcode 
            and  xzflag in ('30')       select @dzyh31=round(isnull(sum(isnull(fyprice,0)*isnull(ty_num,0)),0),1) from zy_ypout_x /*西药费--四舍五入到角*/
          where  depa=@depa
            and  fycode=@cfcode 
            and  xzflag not in ('01','20','21','30')       select @dfprice = @xyf01 + @zyf20 + @zyf21 + @wc30 + @dzyh31       select @xyf01=0,@zyf20=0, @zyf21=0, @wc30=0 , @dzyh31=0       select @xyf01=round(isnull(sum(isnull(fyprice,0)*(isnull(fynum,0)+isnull(ty_num,0))),0),1) from zy_ypout_x /*中药费--四舍五入到角*/
          where  depa=@depa
            and  fycode=@cfcode 
            and  xzflag in ('01')       select @zyf20=round(isnull(sum(isnull(fyprice,0)*(isnull(fynum,0)+isnull(ty_num,0))),0),1) from zy_ypout_x /*中药费--四舍五入到角*/
          where  depa=@depa
            and  fycode=@cfcode 
            and  xzflag in ('20')       select @zyf21=round(isnull(sum(isnull(fyprice,0)*(isnull(fynum,0)+isnull(ty_num,0))),0),1) from zy_ypout_x /*中药费--四舍五入到角*/
          where  depa=@depa
            and  fycode=@cfcode 
            and  xzflag in ('21')       select @wc30=round(isnull(sum(isnull(fyprice,0)*(isnull(fynum,0)+isnull(ty_num,0))),0),1) from zy_ypout_x /*中药费--四舍五入到角*/
          where  depa=@depa
            and  fycode=@cfcode 
            and  xzflag in ('30')       select @dzyh31=round(isnull(sum(isnull(fyprice,0)*(isnull(fynum,0)+isnull(ty_num,0))),0),1) from zy_ypout_x /*西药费--四舍五入到角*/
          where  depa=@depa
            and  fycode=@cfcode 
            and  xzflag not in ('01','20','21','30')       select @sumfee =  @xyf01 + @zyf20 + @zyf21 + @wc30 + @dzyh31 
       end    if @flag='0' /*门诊药房划价*/
       begin
          select @dfprice=isnull(sum(isnull(fyprice,0)*isnull(fynum,0)/isnull(fushu,1)),0) from mz_xy_hj 
          where  depa=@depa
            and  fycode=@cfcode       select @xyf01=round(isnull(sum(isnull(fyprice,0)*isnull(fynum,0)),0),1) from mz_xy_hj /*西药费--四舍五入到角*/
          where  depa=@depa
            and  fycode=@cfcode 
            and  yp_style in ('01') 
          
          select @zyf20=round(isnull(sum(isnull(fyprice,0)*isnull(fynum,0)),0),1) from mz_xy_hj /*中成药费--四舍五入到角*/
          where  depa=@depa
            and  fycode=@cfcode 
            and  yp_style in ('20')       select @zyf21=round(isnull(sum(isnull(fyprice,0)*isnull(fynum,0)),0),1) from mz_xy_hj /*中草药费--四舍五入到角*/
          where  depa=@depa
            and  fycode=@cfcode 
            and  yp_style in ('21')       select @wc30=round(isnull(sum(isnull(fyprice,0)*isnull(fynum,0)),0),1) from mz_xy_hj /*卫生材料费--四舍五入到角*/
          where  depa=@depa
            and  fycode=@cfcode 
            and  yp_style in ('30') 
         
          select @dzyh31=round(isnull(sum(isnull(fyprice,0)*isnull(fynum,0)),0),1) from mz_xy_hj /*低值易耗费--四舍五入到角*/
          where  depa=@depa
            and  fycode=@cfcode 
            and  yp_style not in ('01','20','21','30')       select @sumfee = @xyf01 + @zyf20 + @zyf21 + @wc30 + @dzyh31
       end    if @flag='7' /*中医院门诊药房划价*/
       begin
          select @dfprice=isnull(sum(isnull(fyprice,0)*isnull(fynum,0)/isnull(fushu,1)),0) from mz_xy_hj 
          where  depa=@depa
            and  fycode=@cfcode       select @zyfee=round(isnull(sum(isnull(fyprice,0)*isnull(fynum,0)),0),1) from mz_xy_hj /*中药费--四舍五入到角*/
          where  depa=@depa
            and  fycode=@cfcode 
            and  yp_style in ('20','21')       select @xyfee=round(isnull(sum(isnull(fyprice,0)*isnull(fynum,0)),0),1) from mz_xy_hj /*西药费--四舍五入到角*/
          where  depa=@depa
            and  fycode=@cfcode 
            and  yp_style not in ('20','21','40')       select @zlfee=round(isnull(sum(isnull(fyprice,0)*isnull(fynum,0)),0),1) from mz_xy_hj /*西药费--四舍五入到角*/
          where  depa=@depa
            and  fycode=@cfcode 
            and  yp_style in ('40')       select @sumfee = @zyfee + @xyfee +  @zlfee
       end    if @flag='2' /*门诊药房退药*/
       begin
          select @dfprice=isnull(sum(isnull(lsprice,0)*isnull(num,0)/isnull(fushu,1)),0) from br_ty 
          where  depa=@depa
            and  fycode=@cfcode 
            and  flag='0'      select @xyf01=round(isnull(sum(isnull(lsprice,0)*isnull(num,0)),0),1) from br_ty /*中药费--四舍五入到角*/
          where  depa=@depa
            and  fycode=@cfcode 
            and  yp_style in ('01') 
            and  flag='0'
          
          select @zyf20=round(isnull(sum(isnull(lsprice,0)*isnull(num,0)),0),1) from br_ty /*中药费--四舍五入到角*/
          where  depa=@depa
            and  fycode=@cfcode 
            and  yp_style in ('20') 
            and  flag='0'      select @zyf21=round(isnull(sum(isnull(lsprice,0)*isnull(num,0)),0),1) from br_ty /*中药费--四舍五入到角*/
          where  depa=@depa
            and  fycode=@cfcode 
            and  yp_style in ('21') 
            and  flag='0'
          select @wc30=round(isnull(sum(isnull(lsprice,0)*isnull(num,0)),0),1) from br_ty /*中药费--四舍五入到角*/
          where  depa=@depa
            and  fycode=@cfcode 
            and  yp_style in ('30') 
            and  flag='0'      select @dzyh31=round(isnull(sum(isnull(lsprice,0)*isnull(num,0)),0),1) from br_ty /*西药费--四舍五入到角*/
          where  depa=@depa
            and  fycode=@cfcode 
            and  yp_style not in ('01','20','21','30') 
            and  flag='0'      select @sumfee = @xyf01 + @zyf20 + @zyf21 + @wc30 + @dzyh31
       end 
       if @flag='8' /*中医院门诊药房退药*/
       begin
          select @dfprice=isnull(sum(isnull(lsprice,0)*isnull(num,0)/isnull(fushu,1)),0) from br_ty 
          where  depa=@depa
            and  fycode=@cfcode 
            and  flag='0'      select @zyfee=round(isnull(sum(isnull(lsprice,0)*isnull(num,0)),0),1) from br_ty /*中药费--四舍五入到角*/
          where  depa=@depa
            and  fycode=@cfcode 
            and  yp_style in ('20','21') 
            and  flag='0'      select @xyfee=round(isnull(sum(isnull(lsprice,0)*isnull(num,0)),0),1) from br_ty /*西药费--四舍五入到角*/
          where  depa=@depa
            and  fycode=@cfcode 
            and  yp_style  in ('30','31') 
            and  flag='0'      select @zlfee=round(isnull(sum(isnull(lsprice,0)*isnull(num,0)),0),1) from br_ty /*西药费--四舍五入到角*/
          where  depa=@depa
            and  fycode=@cfcode 
            and  yp_style  in ('40') 
            and  flag='0'      select @sumfee = @zyfee + @xyfee + @zlfee
       end    set nocount off 
    end 
    GO
      

  3.   


    ADOQueryzy_xy_hj.FieldByName('fyprice').asstring:=editprice.text;    //药品单价
          ADOQueryzy_xy_hj.FieldByName('fynum').asstring:=editnum.text;  
    这些在数据库里应该是 decimal,int 类型的吧
      

  4.   

    我跟踪了一下,问题应该出在ADOQueryzy_xy_hj.append;这一句,不知怎么回事?
      

  5.   

    ADOQueryzy_xy_hj中的sql语句是什么?