当前位置: 代码迷 >> ASP.NET >> 关于重载的有关问题
  详细解决方案

关于重载的有关问题

热度:4480   发布时间:2013-02-26 00:00:00.0
关于重载的问题
[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Delete,   true)]
public   bool   DeleteProduct(int   productID)
{
    int   rowsAffected   =   Adapter.Delete(productID);

    //   Return   true   if   precisely   one   row   was   deleted,   otherwise   false
    return   rowsAffected   ==   1;
}

编译这里的时候提示“delete”方法没有采用“1”个参数的重载

哪里错了呢?

------解决方案--------------------------------------------------------
看一下你的Delete方法是怎么定义的,在这里需要一个int型的变量作为参数的
------解决方案--------------------------------------------------------
没看过这本书,不过刚刚把它提供的源码下来看了下,ProductsTableAdapter类里确实没有采用一个参数重载的Delete方法,它所提供的代码应该是不全的,或者你回复一下翻译者,咨询一下吧
------解决方案--------------------------------------------------------
int rowsAffected = Adapter.Delete(productID);
原函数是如何的?
------解决方案--------------------------------------------------------
Adapter.Delete(productID)参数不对
  相关解决方案