"Failed to find non-generic method with parameters" solution in asp.net2.0 for GridView delete operation

Source: Internet
Author: User
Tags net bug
Asp.net| Solution

When ObjectDataSource automatically configures the delete operation for a data source in ASP.net, two fields are generated one is

oldvaluesparameterformatstring= "Original_{0}"

The other one is

<DeleteParameters>
<asp:parameter name= "original_xml_id" type= "Int32"/>
</DeleteParameters>

This oldvaluesparameterformatstring is determined by the parameters in the SQL statement you set, and parameter name is determined by the first parameter that deletes the function in your business ROM base.
For example, your deletion component in the business logic layer is defined in this way, and the first parameter in the function is the ObjectDataSource-generated parameter Name

[System.ComponentModel.DataObjectMethodAttribute (System.ComponentModel.DataObjectMethodType.Delete, True)]
public bool Delxml (int original_xml_id)
{
int rowsaffected = Adapter.delete (original_xml_id);

return rowsaffected = = 1;
}

Here's what you should be aware of. The name of the parameter in the parentheses in the Del function and the name of the parameter in SQL if it is not the same, the "BLL method with parameters could not be found" is a strange error. I don't know if it's a asp.net bug, but it's really annoying. Even Microsoft's official tutorials (see www.asp.net) did not solve the bug.

I searched the solution on the Internet for this problem, and did not find a more detailed one. Fantasia also found a similar problem and referred to his solution.



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.