我的方法执行中出现错误 [英] Error in the implementation of my method
本文介绍了我的方法执行中出现错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我实现方法 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 thatser.AnnulerPaiement
method return nothing [its return type is void] and your code expecting aint
from that method. Either change the return type of the method fromvoid
toint
or remove the if check.
要么将方法的返回类型从void
更改为int
,要么删除if检查.从CreationPaiementWCF
调用AnnulerPaiementWCF
的方式.
You need to post code forCreationPaiementWCF
. Something may be wrong in the way you are callingAnnulerPaiementWCF
fromCreationPaiementWCF
.
这篇关于我的方法执行中出现错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文