Here’s the setup
- I have a
DetailsViewwhoseDataSourceis anObjectDataSource. - The
ObjectDataSourcehas two methods, select and update, that are stored procedures defined in aTableAdapter. - The
Selectstored procedure takes 1 parameter–the record id–and returns the fields populated in theDetailsView. - The
Updatestored procedure takes three parameters–the record id, and two data fields.
The select process works fine.
However, when the I submit the update, I get the following error:
ObjectDataSourcecould not find a non-generic methodUpdatethat has parameters: [all 21 table columns]
I am trying to only pass the (3) necessary fields to the Update stored procedure, but the DetailsView is apparently trying to update using all of the fields it received from Select.
I know that I can access the NewValues collection from DetailsViewUpdateEventArgs, but I don’t see a way to remove any of the parameters so that they match the definition in the stored procedure, the TableAdapter, and the ObjectDataSource.
Any ideas?
Perhaps this tutorial can provide some insight. As long as you specify your update method and update parameters in your datasource, this should work fine.