ObjectDataSource Insert and Update methods error

Posted by Jack on Stack Overflow See other posts from Stack Overflow or by Jack
Published on 2010-05-25T09:04:57Z Indexed on 2010/05/25 11:01 UTC
Read the original article Hit count: 304

Filed under:
|
|
|
|

I m developing asp.net 3.5 project.

When I want to Insert with DetailsView this error occured:

Error : ObjectDataSource 'ObjectDataSource2' could not find a non-generic method 'AddCity' that has parameters: CITY_NAME.

<asp:ObjectDataSource ID="ObjectDataSource2" runat="server" SelectMethod="GetCityByID" UpdateMethod="UpdateCity" InsertMethod="AddCity" TypeName="NOP_CRM.Lib.nop_cities" OldValuesParameterFormatString="original_{0}">
    <SelectParameters>
        <asp:ControlParameter ControlID="GridView1" Name="cityid" PropertyName="SelectedValue" Type="Int32" DefaultValue="1" />
    </SelectParameters>
    <UpdateParameters>                              
        <asp:Parameter Name="CITY_NAME" Type="String" />
    </UpdateParameters>
    <InsertParameters>
        <asp:Parameter Name="CITY_NAME" Type="String" />
    </InsertParameters>                                
</asp:ObjectDataSource>                    

...

public int AddCity(string cityname)
{
    CITY_NAME = cityname;
    Insert();
    return _CITY_ID;            
}        

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET