ePMTDAO does not implement interface member 'IWCFService1.InsertUserRequestForm(RequestOrder)'. 'ePMTDAO.InsertUserRequestForm(RequestOrder) RRS feed

  • Question

  • User-2071549094 posted

    Hi expert,

    I am getting the above error.  Not sure if it is because DAO class and the Service class cannot mixed together.

    Cos I am putting in the Service class method together in my DAO class to try thing out.

    However, I need to inherit the Service class interface  - IWCFService1 so am not sure if this is giving me the error ?

     public class ePMTDAO : IWCFService1
            SqlConnection pcon = new SqlConnection(ConfigurationManager.AppSettings["EPMT"]);
    // my DAO class
    internal DataTable BindEmployee(string search, string searchby)
                SqlCommand cmd = new SqlCommand("eDNSN_SP_BindEmployee", con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@Search", search);
                cmd.Parameters.AddWithValue("@Searchby", searchby);
                SqlDataAdapter da = new SqlDataAdapter(cmd);
                DataTable dt = new DataTable();
                return dt;
    // My WebService method
     internal void InsertUserRequestForm(RequestOrder req)
               // string Result;
                //SqlCommand cmd = new SqlCommand("ePMT_SP_UpdateEPMTRequest", con);
                SqlCommand cmd = new SqlCommand("ePMT_Sp_SaveEMPTRequest", con);
               //cmd.Parameters.AddWithValue("@action", action);
                cmd.Parameters.AddWithValue("@epmtNumber", req.EMPTId);
                cmd.Parameters.AddWithValue("@iSGGID", req.InitiatorSGGID);       
     cmd.CommandType = CommandType.StoredProcedure;

    Furthermore, when I tried to call this WebService method in my button event firing, it says not in the current context :(

    protected void btnSave_Click(object sender, EventArgs e)
                if (Request.QueryString["EPMTID"] != null)
                    RequestOrder req = new RequestOrder();
                    InsertUserRequestForm(req); // error here

    Hope someone can advise me.

    Do I have to put the webservice's method  in another new class ?

    Friday, January 27, 2017 1:44 AM

All replies

  • User-2057865890 posted

    Hi Tangara,

    You could write like this.

    interface IWCFService1
       void InsertUserRequestForm(RequestOrder req);
    ... } public class RequestOrder {
    ... } public class ePMTDAO : IWCFService1 { public void InsertUserRequestForm(RequestOrder req) {
    ... } }

    Call method

    var req = new RequestOrder();
    var dao = new ePMTDAO();

    reference: https://msdn.microsoft.com/en-us/library/87d83y5b.aspx

    Best Regards,


    Sunday, January 29, 2017 2:38 PM