none
Can you help me what does a dataset return RRS feed

  • Question

  • Dear All,
    I am probably going mad or just need a walk but what does a Dataset return. I have this function it was making sense when I was writing it but now time to compile I have this error: Not All Code Path Return a value error I know it is something simple but can't get my head around it.

    Here is the function

    public DataSet Agreement_FetchbyID()

    {

    try

    {

    DataSet Agreement_FetchbyID = new DataSet();

    base.sql= "Agreement_FetchbyID";

    base.InitialiseCommand();

    base.AddParameter("@Agr_Id", SqlDbType.Int, 16, "Agr_ID");

    base.FillDataSet(ref Agreement_FetchbyID,"Agreement");}

    catch (Exception ExceptionErr)

    {

    throw new System.Exception(ExceptionErr.Message, ExceptionErr.InnerException);

    }

    }


    Many thanks for your help


    JacquesM
    Saturday, January 31, 2009 1:01 PM

Answers

  • You have to instruct the method to return something !

    I looks like you have to insert:

    return Agreement_FetchbyID;

    just before the "catch"-line.


    Best regards KSor, Denmark
    • Marked as answer by xpnewusers Friday, February 13, 2009 10:46 AM
    Sunday, February 1, 2009 6:22 AM
  • public DataSet Agreement_FetchbyID(int AgrId)
        {
          DataSet _ds = default(DataSet);
          try
          {
            _ds = new DataSet();
            base.sql = "Agreement_FetchbyID";
            base.InitialiseCommand();
            base.AddParameter("@AgrID", SqlDbType.Char, 8, AgrID);
            base.FillDataSet(ref _ds, "Agreement");
    
          }
          catch (Exception ex)
          {
            throw new Exception(ex.Message, ex.InnerException);
          }
          return _ds;
        }

    Sorry I figured out this ages ago but I never postedit here so maybe it will help one or two people.

     

    Thanks


    JacquesM
    • Marked as answer by xpnewusers Saturday, May 22, 2010 12:44 PM
    Saturday, May 22, 2010 12:44 PM

All replies

  • You have to instruct the method to return something !

    I looks like you have to insert:

    return Agreement_FetchbyID;

    just before the "catch"-line.


    Best regards KSor, Denmark
    • Marked as answer by xpnewusers Friday, February 13, 2009 10:46 AM
    Sunday, February 1, 2009 6:22 AM
  • public DataSet Agreement_FetchbyID(int AgrId)
        {
          DataSet _ds = default(DataSet);
          try
          {
            _ds = new DataSet();
            base.sql = "Agreement_FetchbyID";
            base.InitialiseCommand();
            base.AddParameter("@AgrID", SqlDbType.Char, 8, AgrID);
            base.FillDataSet(ref _ds, "Agreement");
    
          }
          catch (Exception ex)
          {
            throw new Exception(ex.Message, ex.InnerException);
          }
          return _ds;
        }

    Sorry I figured out this ages ago but I never postedit here so maybe it will help one or two people.

     

    Thanks


    JacquesM
    • Marked as answer by xpnewusers Saturday, May 22, 2010 12:44 PM
    Saturday, May 22, 2010 12:44 PM