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.aspx.vb" Inherits="admin_Default2" title="Untitled Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="PageHeading" Runat="Server">

</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="PageContents" Runat="Server">

&nbsp;`<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"

AutoGenerateColumns="False" DataSourceID="ObjectDataSource1" Width="536px" DataKeyNames="ratingID">

<Columns>

<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />

<asp:BoundField DataField="ratingID" HeaderText="ratingID" InsertVisible="False"

ReadOnly="True" SortExpression="ratingID" />

<asp:BoundField DataField="rating" HeaderText="rating" SortExpression="rating" />

<asp:BoundField DataField="ip" HeaderText="ip" SortExpression="ip" />

<asp:BoundField DataField="itemID" HeaderText="itemID" SortExpression="itemID" />

<asp:BoundField DataField="comment" HeaderText="comment" SortExpression="comment" />

<asp:CheckBoxField DataField="active" HeaderText="active" SortExpression="active" />

</Columns>

</asp:GridView>

<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetRatings" TypeName="articlesTableAdapters.tblArticleRatingTableAdapter" DataObjectTypeName="articles+tblArticleRatingDataTable" DeleteMethod="DELETE FROM [tblArticleRating] WHERE [ratingID] = @ratingID" UpdateMethod="UPDATE [tblArticleRating] SET [ratingID] = @ratingID, [rating] = @rating, [ip] = @ip, [itemID] = @itemID, [comment] = @comment WHERE [ratingID] = @ratingID">

<UpdateParameters>

<asp:Parameter Name="dataTable" Type="Object" />

<asp:Parameter Name="itemID" Type="Int32" />

</UpdateParameters>

</asp:ObjectDataSource>

</asp:Content>

>


Scot King
SEO Software Tool | Search Engine Optimization

"Get your page rank high"
0
sking
6/2/2008 6:10:34 AM
asp.net.sql-datasource 29906 articles. 0 followers. Follow

4 Replies
4010 Views

Similar Articles

[PageSpeed] 24

I think you miss select parameters tag  for object datasourde, through which you have to pass parameters to get data.


Give a man a fish and you feed him for a day. Teach a man to fish and you feed him forever.
0
ramireddyindia
6/2/2008 12:48:04 PM

Ok, thanks. I fixed that.  The page loads up now, however neither the delete or the update works.  Why doesn't it see the "rating" field?

<asp:Content ID="Content2" ContentPlaceHolderID="PageContents" Runat="Server">

&nbsp;`<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"

AutoGenerateColumns="False" DataSourceID="ObjectDataSource1" Width="536px" DataKeyNames="ratingID">

<Columns>

<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />

<asp:BoundField DataField="ratingID" HeaderText="ratingID" InsertVisible="False"

ReadOnly="True" SortExpression="ratingID" />

<asp:BoundField DataField="rating" HeaderText="rating" SortExpression="rating" />

<asp:BoundField DataField="ip" HeaderText="ip" SortExpression="ip" />

<asp:BoundField DataField="itemID" HeaderText="itemID" SortExpression="itemID" />

<asp:BoundField DataField="comment" HeaderText="comment" SortExpression="comment" />

<asp:CheckBoxField DataField="active" HeaderText="active" SortExpression="active" />

</Columns>

</asp:GridView>

<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetArticleRatings" TypeName="articlesTableAdapters.tblArticleRatingTableAdapter" DataObjectTypeName="articles+tblArticleRatingDataTable" DeleteMethod="DELETE FROM [tblArticleRating] WHERE [ratingID] = @ratingID" UpdateMethod="UPDATE [tblArticleRating] SET [ratingID] = @ratingID, [rating] = @rating, [ip] = @ip, [itemID] = @itemID, [comment] = @comment, [active]=@active WHERE [ratingID] = @ratingID">

<UpdateParameters>

<asp:Parameter Name="dataTable" Type="Object" />

<asp:Parameter Name="itemID" Type="Int32" />

</UpdateParameters>

</asp:ObjectDataSource>

</asp:Content>


Scot King
SEO Software Tool | Search Engine Optimization

"Get your page rank high"
0
sking
6/3/2008 1:43:59 AM

Wow...I really need to learn this better.  I keeping getting this error.  I've got the "method" hard coded into the ObjectDatasource1 below. Why does it still error when I attempt to click update or delete? I put in all the parameters.  A question, the first parameter is the ratingID and this is the ID auto generated 1,2,3,4,5 to number the records in the table.  Does that need to be a parameter? When updating the record, that doesn't need updating...but I would understand that it still needs that parameter to search for the record in the table.

 <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"

AutoGenerateColumns="False" DataSourceID="ObjectDataSource1" Width="536px" DataKeyNames="ratingID">

<Columns>

<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />

<asp:BoundField DataField="ratingID" HeaderText="ratingID" InsertVisible="False"

ReadOnly="True" SortExpression="ratingID" />

<asp:BoundField DataField="rating" HeaderText="rating" SortExpression="rating" />

<asp:BoundField DataField="ip" HeaderText="ip" SortExpression="ip" />

<asp:BoundField DataField="itemID" HeaderText="itemID" SortExpression="itemID" />

<asp:BoundField DataField="comment" HeaderText="comment" SortExpression="comment" />

<asp:CheckBoxField DataField="active" HeaderText="active" SortExpression="active" />

</Columns>

</asp:GridView>

<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetArticleRatings" TypeName="articlesTableAdapters.tblArticleRatingTableAdapter" DeleteMethod="DELETE FROM [tblArticleRating] WHERE [ratingID] = @ratingID" UpdateMethod="UPDATE [tblArticleRating] SET [rating] = @rating, [ip] = @ip, [itemID] = @itemID, [comment] = @comment, [active]=@active WHERE [ratingID] = @ratingID">

<UpdateParameters>

<asp:Parameter Name="ratingID" Type="Int32" />

<asp:Parameter Name="rating" Type="Int32" />

<asp:Parameter Name="ip" Type="string" />

<asp:Parameter Name="itemID" Type="int32" />

<asp:Parameter Name="comment" Type="string" />

<asp:Parameter Name="active" Type="boolean" />

</UpdateParameters>

<DeleteParameters>

<asp:Parameter Name="ratingID" Type="Int32" />

</DeleteParameters>

</asp:ObjectDataSource>

</asp:Content>


Scot King
SEO Software Tool | Search Engine Optimization

"Get your page rank high"
0
sking
6/3/2008 2:19:56 AM

I have my gridview now working, but not with the ObjectDataSource1.  I'm using an sqldatasource instead.  Visual Studio made this in the blink of an eye after I set it up by dragging over a tool. The update and delete works fine now.

 

<%@ Page Language="VB" MasterPageFile="~/templates/admin.master" AutoEventWireup="false" CodeFile="article_comments.aspx.vb" Inherits="admin_Default2" title="Untitled Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="PageHeading" Runat="Server">

</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="PageContents" Runat="Server">

&nbsp;`<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"

AutoGenerateColumns="False" DataSourceID="SqlDataSource1" Width="536px" DataKeyNames="ratingID">

<Columns>

<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />

<asp:BoundField DataField="ratingID" HeaderText="ratingID" InsertVisible="False"

ReadOnly="True" SortExpression="ratingID" />

<asp:BoundField DataField="rating" HeaderText="rating" SortExpression="rating" />

<asp:BoundField DataField="ip" HeaderText="ip" SortExpression="ip" />

<asp:BoundField DataField="itemID" HeaderText="itemID" SortExpression="itemID" />

<asp:BoundField DataField="comment" HeaderText="comment" SortExpression="comment" />

<asp:CheckBoxField DataField="active" HeaderText="active" SortExpression="active" />

</Columns>

</asp:GridView>

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:sqlConnectionString %>"

DeleteCommand="DELETE FROM [tblArticleRating] WHERE [ratingID] = @ratingID" InsertCommand="INSERT INTO [tblArticleRating] ([rating], [ip], [itemID], [comment], [active]) VALUES (@rating, @ip, @itemID, @comment, @active)"

SelectCommand="SELECT * FROM [tblArticleRating]" UpdateCommand="UPDATE [tblArticleRating] SET [rating] = @rating, [ip] = @ip, [itemID] = @itemID, [comment] = @comment, [active] = @active WHERE [ratingID] = @ratingID">

<DeleteParameters>

<asp:Parameter Name="ratingID" Type="Int32" />

</DeleteParameters>

<UpdateParameters>

<asp:Parameter Name="rating" Type="Decimal" />

<asp:Parameter Name="ip" Type="String" />

<asp:Parameter Name="itemID" Type="Int32" />

<asp:Parameter Name="comment" Type="String" />

<asp:Parameter Name="active" Type="Boolean" />

<asp:Parameter Name="ratingID" Type="Int32" />

</UpdateParameters>

<InsertParameters>

<asp:Parameter Name="rating" Type="Decimal" />

<asp:Parameter Name="ip" Type="String" />

<asp:Parameter Name="itemID" Type="Int32" />

<asp:Parameter Name="comment" Type="String" />

<asp:Parameter Name="active" Type="Boolean" />

</InsertParameters>

</asp:SqlDataSource>

 

</asp:Content>


Scot King
SEO Software Tool | Search Engine Optimization

"Get your page rank high"
0
sking
6/3/2008 4:56:25 AM
Reply:

Similar Artilces:

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

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

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

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

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

Web resources about - ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'GetRatings' that has no parameters. - asp.net.sql-datasource

Resources last updated: 1/20/2016 10:04:18 AM