ObjectDataSource Insert and Update methods error
- by Jack
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;
}