像'xxxxxxxx(classname)'这样的CS1061错误不包含'updateconfirmstatus'的定义,也没有扩展方法..... [英] CS1061 error like 'xxxxxxxx(classname)’ does not contain a definition for 'updateconfirmstatus' and no extension method.....

查看:131
本文介绍了像'xxxxxxxx(classname)'这样的CS1061错误不包含'updateconfirmstatus'的定义,也没有扩展方法.....的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个类库Customer的类库有方法



i have a class library with class "Customer" having method

public void updateconfirmstatus(int p, int reg_id, int status)
   {
       CustomerDac.myupdateconfirmstatus(p, reg_id, status);

   }




public static void myupdateconfirmstatus(int p, int reg_id, int status)
        {
           //Logic...
    }





即时通讯使用student.aspx





im using student.aspx

using Myproject.Business;










protected void DoctorDetails_RowUpdating(object sender,GridViewUpdateEventArgs e)
    {
 try
        {
            Customer customer = new Customer();
            int reg_id = Convert.ToInt32(DoctorDetails.DataKeys[e.RowIndex].Value.ToString());

            DropDownList ddlIs_Disabled = (DropDownList)DoctorDetails.Rows[e.RowIndex].FindControl("ddlIs_Disabled");
            int status = ddlIs_Disabled.SelectedIndex;
            customer.updateconfirmstatus(Convert.ToInt32(Request.QueryString["appid"].ToString()), reg_id, status);     // Here Im getting error

            DoctorDetails.EditIndex = -1;
            bindstudentlist();
        }
        catch (Exception ex)
        {
            throw ex;
        }

}





尽管我已将库添加到我的项目中,并且我的班级有方法它显示我这样的错误





Eventhough i added library to my project,and my class having method it shows me error like this

'DrugDetails.Business.Customer' does not contain a definition for 'updateconfirmstatus' and no extension method 'updateconfirmstatus' accepting a first argument of type 'DrugDetails.Business.Customer' could be found (are you missing a using directive or an assembly reference?	





为什么会发生这种情况以及如何解决这个问题...谢谢......



Why this happens and how to resolve this...Thank you...

推荐答案

myupdateconfirmstatus 是静态方法:这意味着它不能与实例值一起使用。您需要从定义中删除 static 关键字,或者这样调用:

myupdateconfirmstatus is a static method: which means it cannot be used with instance values. You either need to remove the static keyword from the definition, or call it this way:
Customer.updateconfirmstatus(Convert.ToInt32(Request.QueryString["appid"].ToString()), reg_id, status);

这使用类名而不是实例。

This uses the Class name, rather than the instance.


这篇关于像'xxxxxxxx(classname)'这样的CS1061错误不包含'updateconfirmstatus'的定义,也没有扩展方法.....的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆