Click here to Skip to main content
15,949,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am getting following error in my code:

Error:

'WcfClient.Client.ConsultationClientWCF(ref int)': not all code paths return a value


Code
public  retour ConsultationClientWCF( ref int ID_CLIENT)
  {
      Service1 ser = new Service1();
      ser.ConsultationClient(ID_CLIENT);

      if ( ser.ConsultationClient(ID_CLIENT).Equals(0)){
          retour rt = new retour();
          rt.succes = 0;
          rt.msgsucces = "opération réeussite";
          return rt;
      }

      else if (ser.ConsultationClient(ID_CLIENT).Equals(-1)){
          retour ht = new retour();
          ht.echec = -1;
          ht.msgechec = "Operation échoué";
        return ht;
      }
  }


Pease help me :( :( :( :(
Posted
Updated 30-May-10 4:53am
v2

1 solution

You need to have a return value for the else part of the statement.

if ( ser.ConsultationClient(ID_CLIENT).Equals(0)){
retour rt = new retour(); 
rt.succes = 0;
rt.msgsucces = "opération réeussite";
return rt; 
}

else if (ser.ConsultationClient(ID_CLIENT).Equals(-1)){ 
retour ht = new retour();
ht.echec = -1;
ht.msgechec = "Operation échoué";
return ht; 
}
else
{
return null;//or some other value here;
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900