我的方法执行中出现错误 [英] Error in the implementation of my method

查看:95
本文介绍了我的方法执行中出现错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



当我实现方法 CreationPaiementWCF 时,出现此错误:

错误:
运算符.''不能应用于类型为"void"的操作数

代码

Hi,

When I implement my method CreationPaiementWCF, i get this error:

Error:
Operator ''.'' cannot be applied to operand of type ''void''

Code

public retour AnnulerPaiementWCF(ref int CodePai, ref DateTime DatePai, ref string TypePai, ref int IdPiecePai, ref decimal MontantPai, ref int IndicatPai, ref DateTime DateVersement, ref DateTime DateLimPai)
       {
           Service1 ser = new Service1();
           retour rt = new retour();


           if (ser.AnnulerPaiement(CodePai, DatePai, TypePai, IdPiecePai, MontantPai, IndicatPai, DateVersement, DateLimPai).Equals(-1))
           {
               try
               {
                   rt.CodeRetour = -1;

                   rt.msgRetour = "Annulation paiement échouée";
               }
               catch (Exception e)
               {
                   CreateLog log = new CreateLog(e);
                   log.ErrorLog(@"C:\Documents and Settings\Administrateur\Bureau\fichierLog.txt");
               }
               return rt;

           }
           else
           {
               rt.CodeRetour = 0;
               rt.msgRetour = "Annulation paiement réussite";

               return rt;
           }

       }


请帮助我:(


Please help me :(

推荐答案

我确定ser.AnnulerPaiement方法什么也不返回[返回类型为void],并且您的代码期望该方法返回int
I am sure that ser.AnnulerPaiement method return nothing [its return type is void] and your code expecting a int from that method. Either change the return type of the method from void to int or remove the if check.


要么将方法的返回类型从void 更改为int ,要么删除if检查.从CreationPaiementWCF调用AnnulerPaiementWCF的方式.
You need to post code for CreationPaiementWCF. Something may be wrong in the way you are calling AnnulerPaiementWCF from CreationPaiementWCF.


这篇关于我的方法执行中出现错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆