ObjectDataSource 'DetailDataSource' could not find a non-generic method 'UpdateByKey'

Hi all,

I am building a master / detail page using a dropdown dialog and a formview control. I have run into problem with wiring up both the update and delete commands - only the insert and select worked out the box as such.

I am using a objectdatasource to connect to a types data set which as you know includes update, delete, insert etc methods. As I said neither the delete or the update worked. The only thing I noticed was that the standard suplied method included a parameter for each column; the delete for example matches on all column values and not simply the key column. As such I defined a new method for delete that takes only the table key column value as a a parameter. This worked. I have tried the same but continue to get the same error ...

ObjectDataSource 'DetailDataSource' could not find a non-generic method 'UpdateByKey' that has parameters: Name, ReferenceId, Type, ParentAccountId, BaseUnitPrice, BasePriceListId, original_AccountId.

The method is defined as

       public virtual int UpdateByKey(string Name, string ReferenceId, string Type, int ParentAccountId, decimal BaseUnitPrice, int BasePriceListId, int original_AccountId) {
            System.Data.SqlClient.SqlCommand command = this.CommandCollection[3];
            if ((Name == null)) {
                throw new System.ArgumentNullException("Name");
            }
            else {
                command.Parameters[0].Value = ((string)(Name));
            }
            if ((ReferenceId == null)) {
                throw new System.ArgumentNullException("ReferenceId");
            }
            else {
                command.Parameters[1].Value = ((string)(ReferenceId));
            }
            if ((Type == null)) {
                throw new System.ArgumentNullException("Type");
            }
            else {
                command.Parameters[2].Value = ((string)(Type));
            }
            command.Parameters[3].Value = ((int)(ParentAccountId));
            command.Parameters[4].Value = ((decimal)(BaseUnitPrice));
            command.Parameters[5].Value = ((int)(BasePriceListId));
            command.ParametersDevil [6].Value = ((int)(original_AccountId));
            System.Data.ConnectionState previousConnectionState = command.Connection.State;
            command.Connection.Open();
            int returnValue;
            try {
                returnValue = command.ExecuteNonQuery();
            }
            finally {
                if ((previousConnectionState == System.Data.ConnectionState.Closed)) {
                    command.Connection.Close();
                }
            }
            return returnValue;
        }


.. and the DetailDataSource as ...

  <asp:ObjectDataSource ID="DetailDataSource" runat="server" DeleteMethod="DeleteByAccountId"
        InsertMethod="Insert" SelectMethod="GetDataByAccountId" TypeName="Iml.License.LicenseDataSetTableAdapters.AccountTableAdapter"
        UpdateMethod="UpdateByKey">
        <DeleteParameters>
            <asp:Parameter Name="Original_AccountId" Type="Int32" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="Name" Type="String" />
            <asp:Parameter Name="ReferenceId" Type="String" />
            <asp:Parameter Name="Type" Type="String" />
            <asp:Parameter Name="ParentAccountId" Type="Int32" />
            <asp:Parameter Name="BaseUnitPrice" Type="Decimal" />
            <asp:Parameter Name="BasePriceListId" Type="Int32" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="Name" Type="String" />
            <asp:Parameter Name="ReferenceId" Type="String" />
            <asp:Parameter Name="Type" Type="String" />
            <asp:Parameter Name="ParentAccountId" Type="Int32" />
            <asp:Parameter Name="BaseUnitPrice" Type="Decimal" />
            <asp:Parameter Name="BasePriceListId" Type="Int32" />
            <asp:Parameter Name="original_AccountId" Type="Int32" />
        </UpdateParameters>
        <SelectParameters>
            <asp:ControlParameter ControlID="AccountDropDownList" DefaultValue="0" Name="AccountId"
                PropertyName="SelectedValue" Type="Int32" />
        </SelectParameters>
    </asp:ObjectDataSource>



All help appreciated,

Thanks, Nick
0
NickInUk
7/27/2005 11:53:46 AM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

1 Replies
506 Views

Similar Articles

[PageSpeed] 37

Hi Nick

I am assuming that the OldValuesParameterFormatString is set to original_{0}. Please confirm this before going any further. Then, we need to make sure that the DataKeyNames property is set on the FormView control to a valid key. This is needed for the Update and Delete operations.

Hope this helps
Irinel


This posting is provided "AS IS" with no warranties, and confers no rights.
0
irinelc
7/27/2005 5:50:10 PM
Reply:

Similar Artilces:

ObjectDataSource '...' could not find a non-generic method '...'
In Visual Studio 2008 Professional Edition, I've created an ASPX page that uses a DetailsView and an ObjectDataSource ('ObjectDataSource1') to connect to an Access 2003 database, via a TableAdapter.  I've successfully created SELECT and UPDATE ('UpdateAddrQuery') methods in the TableAdapter but noticed that when I included any of these columns [E-mail], [2003Campaign], [2007Campaign], [Date Joined], [Grant Size], and [Next Deadline], it would generate an error message.  In the case  of [Next Deadline] it is as follows:   ObjectDataSource 'O...

''''''''''''''''''''
Name: haznen Email: haznenatyahoodotcom Product: Gran Paradiso Alpha 8 Summary: '''''''''''''''''''' Comments: '''''''''''''''''''''''''''''''''''' Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20061204 UGES/1.7.2.0 GranParadiso/3.0a1 From URL: http://www.mozilla.org/projects/granparadiso/ Note to readers: Hendrix gives...

ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'name_of_the Method' that has parameters
Hi am getting this error when am trying to insert new record in Details View   ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'insertdata' that has parameters    The data source for the details view is objectdatasoure which configured on class located in app_code folder   the class contain 2 methods one for selecting and one for inserting  ,     please anyone can help to solve this problem 1) Did you define the method that will handle the inserting for the ObjectDataSource control? (posting the code from the .as...

ObjectDataSource 'ObjectDataSourceMac' could not find a non-generic method 'Update'
I am using GridView for editing my data in Visual Studio 2005. So, when I click on "update", following error has been occuring. ObjectDataSource 'ObjectDataSourceMac' could not find a non-generic method 'Update' that has parameters: Machine_Type, Model, Manufacturer, Sold, original_Machine_ID, Machine Type. May the smile on your face Come straight from your heart :)khuram latifSr. Web Developer, As the error message suggests, you need an Update command in your ObjectDataSource that has those parameters. It must also be non-generic, again, as the error m...

ObjectDataSource 'ObjectDataSource2' could not find a non-generic method 'UpdateProducts'
 I am getting this error with my update method on a formview.  Any ideas? Server Error in '/' Application. ObjectDataSource 'ObjectDataSource2' could not find a non-generic method 'UpdateProducts' that has parameters: ProductCategoryID1Label, ProductName, ProductDescription, ProductImageUrl, ProductPrice, WebsiteCategoryID, ProductCategoryName, ProductCategoryDescription, ProductCategoryID1, original_ProductCategoryID, original_ProductItemID. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more ...

ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'insertCourse'
I am trying to use the detailsView on my page to allow for the insertion and editting of course records in my system.  this is my first time using them as my previouse 2.0 outings i have just coded the forms myself and worked that way.  for almost 2 days now i have been fighting with this problem but cant seem to find an answer, i keep getting the error message:  ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'insertCourse' that has parameters: courseCode, venueID, typeID, programmeID, title, subTitle, description, accreditted, startD...

ObjectDataSource 'OdsGetRoles' could not find a non-generic method 'AddRole'
I have created a objectdatasource that gets roles from the membership provider db. I am able to use this to select roles, but i cannot get it to Insert. I keep getting "ObjectDataSource 'OdsGetRoles' could not find a non-generic method 'AddRole' that has parameters: RoleName, !." I have tried to add the parameter programatically in my code behind file for this page to no avail. I noticed several posts in the asp.net forums concerning this same issue, but i have still not been able to resolve it. I ran this stored procedure in sql and it worked fine. Below is the portion that accesses the sto...

ObjectDataSource 'X' could not find a non-generic method 'Y'
I apologise in advance if this question has already been asked. In Visual Studio 2008 Professional Edition, I've created an ASPX page that uses a DetailsView and an ObjectDataSource  ('ObjectDataSource1') to connect to an Access 2003 database, via a TableAdapter.  I've successfully created SELECT and UPDATE ('UpdateAddrQuery') methods in the TableAdapter but noticed that when I included any of these columns [E-mail], [2003Campaign], [2007Campaign], [Date Joined], [Grant Size], and [Next Deadline], it would generate the following error me...

'''''
Name: mario Email: ramar17atfastwebnetdotit Product: Gran Paradiso Alpha 2 Summary: ''''' Comments: K: Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a2) Gecko/20070206 GranParadiso/3.0a2 ...

ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'GetRatings' that has no parameters.
I've been studying this tutorial over here at: http://quickstarts.asp.net/QuickStartv20/aspnet/doc/data/databases.aspx#updatedelete but I can't seem to get my gridview working.  I want to be able to edit the fields and also delete an entire row from the table if needed. I hard coded in the update and delete commands into my objectdatasource but I still get the error message. Also, I can't even refresh the aspx page: <%@ Page Language="VB" MasterPageFile="~/templates/admin.master" AutoEventWireup="false" CodeFile="article_comments.as...

ObjectDataSource 'assessComps' could not find a non-generic method 'GetCompetenciesByAssessmentID' that has parameters
I am attempting to create a 3 tier architecture as described in Scott Mitchell's tutorial on this site, and I receive the following error that is driving me insane.  ObjectDataSource 'assessComps' could not find a non-generic method 'GetCompetenciesByAssessmentID' that has parameters I have seen several posts in relation to this error message but those all seem to be in regard to inserting, updating, or deleting data. In my case, I only need to select the data, and I couldn't find anything relative to that here. On to the code...  The code for each tier is as follows. Pre...

ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'Update' that has parameters:
Error Message:  Server Error in '/call in' Application.-------------------------------------------------------------------------------- ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'Update' that has parameters: Name, Date, Shift, Call_Answered, Left_Message, Call_Returned, Available, Complete, original_TaskID, Call Answered, Left Message, Call Returned. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Excepti...

ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'Insert' that has parameters
Same problem 99% of all Object programmers in VS2005 are having when using Insert and XSD's.  I have a DETAILS VIEW (not a gridview) for INSERTING records into a database.  XSD has been built with ONE stored procedure added to it (thought I'd narrow it down).  The spInsertRecord (for example) is connected to the INSERT dropdown on the datasource and the SELECT procedure (of course, we HAVE to have one of those or you jsut don't get the "next" button in the wonderful wizard of MS) set to CreateObjRef (because I've already tried creating a SP just for ...

ObjectDataSource 'SearchDataSource1' could not find a non-generic method 'Update' that has parameters ...
Sorry to post yet another question about this.  I've spent 5 days googling and found great solutions such as:  In Design Mode on your aspx click on your SearchDataSource and change the OldValuesParameterFormatString from "Origional_{0}" to "{0}" without the quotes.  I've also read that you should set the ID columns read-only property to false.  I've also read several posts where someone has just mis-spelled something or the parameters in their Update didn't match their DataSet.  So I've seen many happy people and I'm a hope...