A Repasky

A Repasky

  • NA
  • 231
  • 182.9k

Not all code paths return a value

Aug 22 2011 2:59 PM
I have the following method. 

      public static DebOop AddToDict(string rc, string memberNbr, string person, string group, string subGroup         , string plancode, iDB2DataReader dr

     {

         DebOop returnvalue = null;

         DebOop record = new DebOop();

         //Main data

         record.SubscriberNumber = dr.GetiDB2Char(0);

         record.PersonNumber = dr.GetiDB2Char(1);

         record.GroupID = dr.GetiDB2Char(2);

         record.Subgroup = dr.GetiDB2Char(3);

         record.Plancode = dr.GetiDB2Char(4);

  . . . . . skipped many records that do the same . . . . . . .

         record.FamDoaOutNetRM = dr.GetiDB2Decimal(85);

         record.returnCode = rc;

         //Finished record 

         returnvalue = record;         

      }

I get the following error:

Error 1 'DedOopData.DebOop.AddToDict(string, string, string, string, string, string, IBM.Data.DB2.iSeries.iDB2DataReader)': not all code paths return a value C:\DedOopData\DedOopData\DebOop.cs 125 28 DedOopData

There is only one path.  So why am I getting the error?  Is this the best way to pass back the Class record?

Thanks,

Arep



Answers (2)