ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'Update' that has parameters:

Looks like I am not the only person th ever have a problem with this, and I have it working fine on other forms.   Any help would be appreciated.  Again here select, and delete are ok.  I handle the adds with BLL code just the Update is making me crazy.  I have included the code for the aspx page and a snippet of the xsd code dealing with the Update. 

Error Message: 

ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'Update' that has parameters: CompanyID, FacilityName, Address1, Address2, City, _Region, PostalCode, original_FacilityID, Region.

The aspx page:

<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false"
    CodeFile="FacilityList.aspx.vb" Inherits="RMCompany_FacilityList" Title="Untitled Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DeleteMethod="Delete"
        InsertMethod="Insert" OldValuesParameterFormatString="original_{0}" SelectMethod="GetData"
        TypeName="CompanyFacilityListTableAdapters.CompanyFacilityListTableAdapter" UpdateMethod="Update">
        <DeleteParameters>
            <asp:Parameter Name="Original_FacilityID" Type="Int32" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="CompanyID" Type="Int32" />
            <asp:Parameter Name="FacilityName" Type="String" />
            <asp:Parameter Name="Address1" Type="String" />
            <asp:Parameter Name="Address2" Type="String" />
            <asp:Parameter Name="City" Type="String" />
            <asp:Parameter Name="_Region" Type="String" />
            <asp:Parameter Name="PostalCode" Type="String" />
            <asp:Parameter Name="Original_FacilityID" Type="Int32" />
        </UpdateParameters>
        <SelectParameters>
            <asp:QueryStringParameter Name="CompanyID" QueryStringField="CompanyID" Type="Int32" />
        </SelectParameters>
        <InsertParameters>
            <asp:Parameter Name="CompanyID" Type="Int32" />
            <asp:Parameter Name="FacilityName" Type="String" />
            <asp:Parameter Name="Address1" Type="String" />
            <asp:Parameter Name="Address2" Type="String" />
            <asp:Parameter Name="City" Type="String" />
            <asp:Parameter Name="_Region" Type="String" />
            <asp:Parameter Name="PostalCode" Type="String" />
        </InsertParameters>
    </asp:ObjectDataSource>
    <br />
    <asp:GridView ID="grdCompanyFacility" runat="server" AutoGenerateColumns="False" CellPadding="4"
        DataKeyNames="FacilityID" DataSourceID="ObjectDataSource1" ForeColor="#333333"
        GridLines="None" ShowFooter="True">
        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <Columns>
            <asp:TemplateField ShowHeader="False">
                <EditItemTemplate>
                    <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" CommandName="Update"
                        Text="Update"></asp:LinkButton>
                    <asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Cancel"
                        Text="Cancel"></asp:LinkButton>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Edit"
                        Text="Edit"></asp:LinkButton>
                    <asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Delete"
                        Text="Delete"></asp:LinkButton>
                </ItemTemplate>
                <FooterTemplate>
                    <asp:Button Text="Add" OnClick="btnAddFacility_Click" runat="server" CssClass="Datagrid1"
                        ID="btnAddFacility" />
                </FooterTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="FacilityID" InsertVisible="False" SortExpression="FacilityID" Visible="False">
                <EditItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Eval("FacilityID") %>'></asp:Label>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("FacilityID") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="CompanyID" SortExpression="CompanyID">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("CompanyID") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label2" runat="server" Text='<%# Bind("CompanyID") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Facility" SortExpression="FacilityName">
                <EditItemTemplate>
                    <asp:TextBox ID="txtFacilityName" runat="server" Text='<%# Bind("FacilityName") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label4" runat="server" Text='<%# Bind("FacilityName") %>'></asp:Label>
                </ItemTemplate>
                <FooterTemplate>
                    <asp:TextBox ID="txtFacilityNameAdd" runat="server">
                    </asp:TextBox>
                </FooterTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Address 1" SortExpression="Address1">
                <EditItemTemplate>
                    <asp:TextBox ID="txtAddress1Edit" runat="server" Text='<%# Bind("Address1") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="txtAddress1" runat="server" Text='<%# Bind("Address1") %>'></asp:Label>
                </ItemTemplate>
                <FooterTemplate>
                    <asp:TextBox ID="txtAddress1Add" runat="server">
                    </asp:TextBox>
                </FooterTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Address 2" SortExpression="Address2">
                <EditItemTemplate>
                    <asp:TextBox ID="txtAddress2Edit" runat="server" Text='<%# Bind("Address2") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="lblAddress2" runat="server" Text='<%# Bind("Address2") %>'></asp:Label>
                </ItemTemplate>
                <FooterTemplate>
                    <asp:TextBox ID="txtAddress2Add" runat="server">
                    </asp:TextBox>
                </FooterTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="City" SortExpression="City">
                <EditItemTemplate>
                    <asp:TextBox ID="txtCityEdit" runat="server" Text='<%# Bind("City") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="lblCity" runat="server" Text='<%# Bind("City") %>'></asp:Label>
                </ItemTemplate>
                <FooterTemplate>
                    <asp:TextBox ID="txtCityAdd" runat="server">
                    </asp:TextBox>
                </FooterTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Region" SortExpression="Region">
                <EditItemTemplate>
                    <asp:TextBox ID="txtRegionEdit" runat="server" Text='<%# Bind("Region") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="lblRegion" runat="server" Text='<%# Bind("Region") %>'></asp:Label>
                </ItemTemplate>
                <FooterTemplate>
                    <asp:TextBox ID="txtRegionAdd" runat="server">
                    </asp:TextBox>
                </FooterTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Postal Code" SortExpression="PostalCode">
                <EditItemTemplate>
                    <asp:TextBox ID="txtPostalCode" runat="server" Text='<%# Bind("PostalCode") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="lblPostalCode" runat="server" Text='<%# Bind("PostalCode") %>'></asp:Label>
                </ItemTemplate>
                <FooterTemplate>
                    <asp:TextBox ID="txtPostalCodeAdd" runat="server">
                    </asp:TextBox>
                </FooterTemplate>
            </asp:TemplateField>
        </Columns>
        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
        <EditRowStyle BackColor="#999999" />
        <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
    </asp:GridView>
</asp:Content>

 

Snippet from the dataset code:

<UpdateCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="False">
                    <CommandText>UPDATE [tblFacility] SET [CompanyID] = @CompanyID, [FacilityName] = @FacilityName, [Address1] = @Address1, [Address2] = @Address2, [City] = @City, [Region] = @Region, [PostalCode] = @PostalCode WHERE (([FacilityID] = @Original_FacilityID))</CommandText>
                    <Parameters>
                      <Parameter AllowDbNull="True" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@CompanyID" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="CompanyID" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="True" AutogeneratedName="" DataSourceName="" DbType="AnsiString" Direction="Input" ParameterName="@FacilityName" Precision="0" ProviderType="VarChar" Scale="0" Size="0" SourceColumn="FacilityName" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="True" AutogeneratedName="" DataSourceName="" DbType="AnsiString" Direction="Input" ParameterName="@Address1" Precision="0" ProviderType="VarChar" Scale="0" Size="0" SourceColumn="Address1" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="True" AutogeneratedName="" DataSourceName="" DbType="AnsiString" Direction="Input" ParameterName="@Address2" Precision="0" ProviderType="VarChar" Scale="0" Size="0" SourceColumn="Address2" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="True" AutogeneratedName="" DataSourceName="" DbType="AnsiString" Direction="Input" ParameterName="@City" Precision="0" ProviderType="VarChar" Scale="0" Size="0" SourceColumn="City" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="True" AutogeneratedName="" DataSourceName="" DbType="AnsiString" Direction="Input" ParameterName="@Region" Precision="0" ProviderType="VarChar" Scale="0" Size="0" SourceColumn="Region" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="True" AutogeneratedName="" DataSourceName="" DbType="AnsiString" Direction="Input" ParameterName="@PostalCode" Precision="0" ProviderType="VarChar" Scale="0" Size="0" SourceColumn="PostalCode" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="False" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@Original_FacilityID" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="FacilityID" SourceColumnNullMapping="False" SourceVersion="Original">
                      </Parameter>
                    </Parameters>
                  </DbCommand>
                </UpdateCommand>
 
0
lblanton
11/2/2006 5:03:09 PM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

7 Replies
2984 Views

Similar Articles

[PageSpeed] 47

It is a known issue with work around, try the link below for the solution.  Hope this helps.

http://kanthu.blogspot.com/2005/10/objectdatasource.html


Kind regards,
Gift Peddie
0
Caddre
11/2/2006 5:19:30 PM

Thanks Caddre,

I have already written the code to update it through a BLL.  What I dont understand it why it works in some other instances, thats really the part that gets my attention.

Larry

0
lblanton
11/2/2006 6:07:06 PM

EDIT 

(ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'Update' that has parameters: CompanyID, FacilityName, Address1, Address2, City, _Region, PostalCode, original_FacilityID, Region. )

That error is not related to BLL, I see table columns that is the reason for the error, there is a miscomunication between objectdatasource and the database.  There is a modified version of the control for sale, try the link below for that but his postings did not cover the work around I gave you.  Hope this helps.

http://www.manuelabadia.com/blog/PermaLink,guid,eaa3eed8-f997-43c4-8c30-78c2f72d0c86.aspx


Kind regards,
Gift Peddie
0
Caddre
11/2/2006 6:16:57 PM

Thanks again,

I solved the problem and now it works as expected.  The problen as it turned was a field named "Region".  Notice the underscore in the error message.  I removed the offending field from the database, rebuilt the dataset and "POOF" no problem.  It may have some special meaning somewhere.

Larry

0
lblanton
11/3/2006 7:01:30 PM
I am glad you have resolved it but the answer to your question is in the first answer you gave me you have done the update in your BLL, well there is no DAL to resolve the update correctly to the database so ObjectDataSource did what it could causing that error so that person selling the extended version may have just added a DAL(data access layer) to it.  If you will use it try to keep all your updates for the data layer because updates in SQL are complex and most tools get confused.
Kind regards,
Gift Peddie
0
Caddre
11/3/2006 7:34:05 PM

Hi there,

   I had the same problem with a field called Region (Suppliers table from NorthWind).  I believe the problem is caused by Region being a keyword (for outlining code) so that when ASP.NET generates code for the DataSet.xsd file it creates a property / pameters called _Region.  However, the GridView is unaware of Region being a keyword so it calls the field Region still.  The GridView passes a parameter called Region, the TableAdapter expects on called _Region and hence you get an error.

   I found a solution to it: rename the Region parameter in the OnUpdating event of the GridView
<code>
 If e.NewValues.Contains("Region") Then
    Dim o As Object = e.NewValues("Region")
    e.NewValues.Remove("Region")
    e.NewValues.Add("_Region", o)
  End If

</code> 

  I blogged more about it http://www.blurty.com/talkread.bml?journal=webgeek&itemid=52196
 

Darren. 

0
darrenb
1/8/2007 6:02:44 PM

This is very weird!

Suddenly, after weeks of progamming and having no problems, right at the presentation of the website...i get this error

ObjectDataSource 'CountriesDataSource' could not find a non-generic method 'GetData' that has parameters: region.

why "region" all the time???

 

greetz

justanotherguy

0
justanotherguy_be
7/9/2007 4:40:12 PM
Reply:

Similar Artilces:

Where do I look in my source to find the code that is causing this error ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'Update' that has parameters
Hi; My problem began when I deleted the key field in my grid view. I checked my web page code and also corrected my update command and parameters in my table adapter. I would really rather not start over. Thanks for any insights !         GMann Hi, Can you provide the code? Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. Hi;   Problem S O L V E D !   I thought ...

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 '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...

ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'updateEvent' that has parameters
Hello, I am a J2EE developer who is now look at ASP.NET 2. I have written two very basic aspx pages and a Eventsdb.cs as the data access layer. However I have encountered the following error when the broswer redirect to the second aspx page : "ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'updateEvent' that has parameters". The first aspx page tags are as follows: <form id="form1" runat="server"> <div> <div style="width: 594px; height: 37px"> <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="ObjectDataSource1" DataTextFi...

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 'ObjectDataSource1' could not find a non-generic method 'FillMenusByLocation' that has parameters: @locationId
I'm trying to use a typed dataset and ObjectDataSource binding to SQLX db using a foreign key to filter the returned result set to display in a GridView.The error is generated when I try to bind the following GridView to the ObjectSource that follows: <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DeleteMethod="Delete" InsertMethod="Insert" SelectMethod="FillMenusByLocation"             TypeName="RestaurantsTableAdapters.MenusTableAdapter" UpdateMethod="Update">    <DeleteParameters> &nbs...

ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'GetData' that has parameters: CustomerID, .
Hi all!  I'm getting this error in my page. I have a ReportViewer object and its ObjectDataSource. I've seen some fixes changing the OldValuesParameterFormatString from "original_{0}" to "{0}", but no way. Any idea? <rsweb:ReportViewer ID="RVScan" runat="server" Font-Names="Verdana" Font-Size="8pt" Height="100px" Width="150px" ShowToolBar="False"> <LocalReport ReportPath="ReportScan.rdlc"> <DataSources> <rsweb:ReportDataSource DataSourceId="ObjectDataSource2" Name="MonitorDS_AuditMonitor" /> </DataSources> </LocalReport> </rsweb:Repo...

ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'xxx' that has [no] parameters: yyyyyyyyy
Please help! This is a simple form with an Add button, a Gridview with Edit and Delete enabled, and an ObjectDataSource. The ObjectDataSource references a class in the App_Code directory, which provides sub routines for the Get, Insert, Update, and Delete actions. Each subroutine calls a stored procedure. The Insert capability works fine, and the GridView displays the data using the Get method just fine as well. However, there are two errors: First is on the UpdateMethod:ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'UpdateObject' that has parameters: objectText....

Error updating with datagridview: ObjectDataSource 'objsavers' could not find a non-generic method 'Update' that has parameters: ContentID, Title, Price, DisplayDate, EndDate, original_ID
Hello,    I am having difficulty with using the objectdatasource tied to a typed dataset in another assembly. I dragged my table over to my typed dataset.  I dragged a datagridview to my form.  I told it to create a new objectadatasource, and pulled its data from a query I added called FillByContentID (which gets its parameter from the querystring, as in request.querystring("id")). It pulls the data just fine, I try to edit a row, and when I update the row, I get the following error message: ObjectDataSource 'objsavers' could not find a non-generic method 'Update...

ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'Insert' that has parameters: Identity Column insertion issue
   Hi, I am using ObjectDatasource for Insert/Update/Delete record from the table. Both Update and Delete are working fine but only problem with Insertion, I have CMP_ID is my primary key(PK) and its 'Identity' coulum, so whenever new record created the PK will generate automatically. Below is my Code snaps. <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DeleteMethod="Delete" InsertMethod="Insert" SelectMethod="GetData" OldValuesParameterFormatString="{0}" TypeName="CompanysDatasetTableAd...

DB Column Name with spaces: ObjectDataSource 'odsEquipment' could not find a non-generic method 'Update' that has parameters
I created a very simple web form to update a table which contains column names with spaces. For example: Serial Number,  Stock Number, etc. However, it seems the FormView control try to find the update method which has two parameters for each column name contains space (one with space and another one of underscore, e.g. Serial Number and Serial_Number) The error message is ObjectDataSource 'odsEquipment' could not find a non-generic method 'Update' that has parameters: Year, Manufacture, Model, Price, Serial_Number, Condition, Stock_Number, Horse_Power, Driv...

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...

Web resources about - ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'Update' that has parameters: - asp.net.presentation-controls

Resources last updated: 12/2/2015 9:58:11 AM