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, startDate, endDate, price, taster, seats, courseProgrammeID, courseSubTitle, venueName, courseTypeID, courseID, courseDescription, courseBookingPrice, tasterEvent, courseTypeName, courseEndDate, courseProgrammeName, courseTitle, numberOfSeats, courseAccredited, courseStartDate.

Which is right becuase i dont have a method with that many parameters in my BAL, for some reason the engine seems to want to pass the values + the older values i guess to implement optimistic concurrency on the records.  My problem is i dont have optimistic concurrency turned on, neither do i want it as the system will be managed by one person.  I have searched high and low and have not been able to find anything that works, I dont understand why i have a paremters collection if the object data source is going to ignore it and not bother implementing the paramaters that i want to send, and then send them AND other parameters it makes no sense.  I am very close to giving up and going back to the old way of doing things of just wiring up the forms manually, as i would have done that by now the time i have spent trying to figure this out.

 Has anyone got any ideas.....pLLLEAAASSEEE!!! :-)


9/6/2007 12:10:53 PM
asp.net.object-datasource 16182 articles. 0 followers. Follow

7 Replies

Similar Articles

[PageSpeed] 27

Please post your web and BAL code.

"Object reference not set to an instance of an object"
9/6/2007 12:42:13 PM

Look at mark-up of ObjectDataSource. There, can exists a attribute like as "oldValues={0}". Remove it.

Tell me if that works.

9/6/2007 12:48:12 PM
 Thanks for responses.

 i dont have the oldValues attribute, i know that was a possible solition but coudnt find it in the sourse.

 BAL to retirieve records

1            Public Shared Function getCourses()
2                Return getCourses(1, course.MaxRows)
3            End Function

Then this

1            Public Shared Function getCourses(ByVal startRowIndex As Integer, ByVal maximumRows As Integer) As List(Of course)
3                Dim courses As List(Of course)
4                Dim key As String = "Courses_courses_" & startRowIndex.ToString() & "_" & maximumRows.ToString()
6                If (courseBase.settings.enableCaching And BizObject.cache(key) IsNot Nothing) Then
7                    'courses are in the cache so grab them out of there instead of hitting our DB
8                    courses = CType(BizObject.cache(key), List(Of course))
9                Else
10                   'Create new instance of Data Class
11                   Dim courseData As New Data.courseProvider()
13                   'Get courseDetails List and load into recordset
14                   Dim recordset As List(Of courseDetails) = courseData.getCourses(getPageIndex(startRowIndex, maximumRows), maximumRows)
16                   Dim test As Integer = getPageIndex(startRowIndex, maximumRows)
18                   'Convert recordset of courseDetails into course list
19                   courses = getCoursesListFromCourseDetailsList(recordset)
21                   'Cache the data
22                   courseBase.cacheData(key, courses)
23               End If
25               'Return the courses
26               Return courses
28           End Function


1            Private Shared Function getCoursesListFromCourseDetailsList(ByVal recordset As List(Of courseDetails)) As List(Of course)
3                Dim courses As New List(Of course)
5                For Each record As courseDetails In recordset
6                    courses.Add(getCourseFromCourseDetails(record))
7                Next
9                Return courses
11           End Function

 This works and i get the values into a gridView all nice up untill now.  My insert function is....

1            Public Shared Function insertCourse(ByVal courseCode As String, ByVal venueID As Integer, ByVal typeID As Integer, _
2                ByVal programmeID As Integer, ByVal title As String, ByVal subTitle As String, ByVal description As String, _
3                ByVal accreditted As Boolean, ByVal startDate As DateTime, ByVal endDate As DateTime, ByVal price As Double, _
4                ByVal taster As Boolean, ByVal seats As Integer) As Integer
6                'Create new instance of data class
7                Dim courseData As New Data.courseProvider()
9                'Create courseDetails object
10               Dim record As New courseDetails(0, courseCode, typeID, "", venueID, "", programmeID, "", title, subTitle, _
11                   description, accreditted, startDate, endDate, price, taster, seats)
13               'Insert the course
14               Dim courseID As Integer = courseData.insertCourse(record)
16               'Purge the cache
17               BizObject.purgeCacheItems("Courses_course")
19               Return courseID
21           End Function

 UI Code. simple

1    <%@ Page Language="VB" MasterPageFile="~/Templates/adminMaster.master" AutoEventWireup="false" CodeFile="manageCourses.aspx.vb" Inherits="admin_courses_manageCourses" title="Untitled Page" %>
2    <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
3        <div id="column1">
4            <h1>Manage Courses<asp:ScriptManager ID="ScriptManager1" runat="server">
5                </asp:ScriptManager>
6            </h1>
7            <asp:UpdatePanel ID="GridViewUpdate" runat="server">
8                <ContentTemplate>
9                      <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="courseObjectDataSource" Width="100%" GridLines="none">
10                       <Columns>
11                           <asp:BoundField DataField="courseCode" HeaderText="Code" SortExpression="courseCode" />
12                           <asp:BoundField DataField="courseTitle" HeaderText="Title" SortExpression="courseTitle" />
13                           <asp:BoundField DataField="courseDescription" HeaderText="Description" SortExpression="courseDescription" />
14                           <asp:BoundField DataField="venueName" HeaderText="Venue" SortExpression="venueName" />
15                           <asp:BoundField DataField="numberOfSeats" HeaderText="Seats" SortExpression="numberOfSeats" />
16                           <asp:BoundField DataField="courseBookingPrice" HeaderText="Price" SortExpression="courseBookingPrice" />
17                           <asp:BoundField DataField="courseStartDate" HeaderText="Course Start" SortExpression="courseStartDate" DataFormatString="{0:dd/MM/yyyy}" HtmlEncode="False" />
18                           <asp:CheckBoxField DataField="courseAccredited" HeaderText="Accredited" SortExpression="courseAccredited" />
19                       </Columns>
20                   </asp:GridView>
21               </ContentTemplate>
22           </asp:UpdatePanel>
24       </div>
25       <div id="column2">
26           <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="conditional">
27               <ContentTemplate>
28                   <asp:DetailsView ID="DetailsView1" runat="server" DataSourceID="courseObjectDataSource"
29                       DefaultMode="Insert" AutoGenerateRows="false">
30                       <Fields>
31                           <asp:BoundField DataField="courseCode" HeaderText="Course Code" />
32                           <asp:BoundField DataField="VenueID" HeaderText="Venue" />
33                           <asp:BoundField DataField="courseTypeID" HeaderText="Type" />
34                           <asp:BoundField DataField="courseProgrammeID" HeaderText="Programme" />
35                           <asp:BoundField DataField="courseTitle" HeaderText="Title" />
36                           <asp:BoundField DataField="coursSubTitle" HeaderText="Sub Title" />
37                           <asp:TemplateField HeaderText="Description">
38                               <InsertItemTemplate>
39                                   <asp:textBox TextMode="multiLine" ID="courseDescription" runat="server" />
40                               </InsertItemTemplate>
41                           </asp:TemplateField>
42                           <asp:TemplateField HeaderText="Accreditted">
43                               <InsertItemTemplate>
44                                   <asp:CheckBox ID="Accreditted" runat="server" Checked="true" />
45                               </InsertItemTemplate>
46                           </asp:TemplateField>
47                           <asp:BoundField DataField="CourseStartDate" HeaderText="Start Date" />
48                           <asp:BoundField DataField="CourseEndDate" HeaderText="End Date" />
49                           <asp:BoundField DataField="CourseBookingPrice" HeaderText="Price" />
50                           <asp:TemplateField HeaderText="Taster Event?">
51                               <InsertItemTemplate>
52                                   <asp:CheckBox ID="Taster" runat="server" Checked="true" />
53                               </InsertItemTemplate>
54                           </asp:TemplateField>
55                           <asp:BoundField DataField="NumberOfSeats" HeaderText="Seats" />                        
56                           <asp:CommandField ShowInsertButton="True" />
57                       </Fields>
58                   </asp:DetailsView>
59               </ContentTemplate>
60           </asp:UpdatePanel>
61           <asp:ObjectDataSource ID="courseObjectDataSource" runat="server" DeleteMethod="deleteCourse"
62               InsertMethod="insertCourse" SelectMethod="getCourses" TypeName="Synthesise.Business.course"
63               UpdateMethod="updateCourse">
64               <DeleteParameters>
65                   <asp:Parameter Name="courseID" Type="Int32" />
66               </DeleteParameters>
67               <UpdateParameters>
68                   <asp:Parameter Name="courseID" Type="Int32" />
69                   <asp:Parameter Name="courseCode" Type="String" />
70                   <asp:Parameter Name="venueID" Type="Int32" />
71                   <asp:Parameter Name="typeID" Type="Int32" />
72                   <asp:Parameter Name="programmeID" Type="Int32" />
73                   <asp:Parameter Name="title" Type="String" />
74                   <asp:Parameter Name="subTitle" Type="String" />
75                   <asp:Parameter Name="description" Type="String" />
76                   <asp:Parameter Name="accreditted" Type="Boolean" />
77                   <asp:Parameter Name="startDate" Type="DateTime" />
78                   <asp:Parameter Name="endDate" Type="DateTime" />
79                   <asp:Parameter Name="price" Type="Double" />
80                   <asp:Parameter Name="taster" Type="Boolean" />
81                   <asp:Parameter Name="seats" Type="Int32" />
82               </UpdateParameters>
83               <InsertParameters>
84                   <asp:Parameter Name="courseCode" Type="String" />
85                   <asp:Parameter Name="venueID" Type="Int32" />
86                   <asp:Parameter Name="typeID" Type="Int32" />
87                   <asp:Parameter Name="programmeID" Type="Int32" />
88                   <asp:Parameter Name="title" Type="String" />
89                   <asp:Parameter Name="subTitle" Type="String" />
90                   <asp:Parameter Name="description" Type="String" />
91                   <asp:Parameter Name="accreditted" Type="Boolean" />
92                   <asp:Parameter Name="startDate" Type="DateTime" />
93                   <asp:Parameter Name="endDate" Type="DateTime" />
94                   <asp:Parameter Name="price" Type="Double" />
95                   <asp:Parameter Name="taster" Type="Boolean" />
96                   <asp:Parameter Name="seats" Type="Int32" />
97               </InsertParameters>
98           </asp:ObjectDataSource>
99       </div>
101  </asp:Content>
102  <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder3" Runat="Server">
103  </asp:Content>

 It is just insert procedure (and probeble the update which i havent tried yet)  I am confused.



9/6/2007 1:16:34 PM

I´m don´t certain about that, but try to remove UpdateParameters. Leave just InputParameters. Cause if you implement Inserting and Updating events (that is something that you can use too) you don´t use UpdateParameters. Just InputParameters. I think that works.

Normally, I don´t use that Parameters in mark-up, cause I use a entities class to set the values between business class and ObjectDataSource. I always use Inserting/Updating events, cause I can set my own parameters. However, I don´t use Bind() on controls when I use FormView.

9/6/2007 1:34:58 PM

I removed the paramters but still had an error.  It seemed that the insert was picking up the values and then picking up the bound columns of the dataView.  I removed them and replaced them with templateItems, which gets rid of the first error but then doesnt pass on any value when i hit the insert button, it simply runs the insert code but with no values??? how do i get the data source to understand i am using templateItems instead of bound items and use those values to insert?

 This is very frustrating  Sad

9/6/2007 2:34:31 PM

I never use DetailView, just FormView and GridView, but both must be a same thing. Don´t set Fields collection inside a DetailView. Input the HTML with yours fields normally. In text property of TextBoxes, place Text='<# Bind("MyField") />'

If don´t works, try use a FormView. It´s looks like a DetailView. I never use Fields collection to do that.

9/6/2007 3:17:01 PM

Thank you for all your replies, i have it working now.

 1) i converted all the fields i needed to template fields which i needed anyway so i dont think this was a big deal and i dont think this fixed it

2) made sure my insert function variables matched the names of the course object e.g. courseTypeID and not typeID which is what i had and it has gone through. this is what fixed it, and i do understand why it wasnt working now.

 Wish this hadnt wasted so much time and i feel a little bit dim for not seeing that before, but i guess we live and learn.

 Thanks again all.


9/6/2007 3:27:34 PM

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

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

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

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

Web resources about - ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'insertCourse' - asp.net.object-datasource

Resources last updated: 1/4/2016 12:35:03 AM