473,386 Members | 1,841 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

ObjectDataSource could not find a non-generic method error

I get the error:

ObjectDataSource 'ObjectDataSource1' could not find a non-generic method
'Insert' that has parameters: last_name, first_name, email, role_id, user_id,
modified_by, modified_date

when my application is trying to insert a record from a formview.

It works fine for delete, update, but insert just keeps failing. I have
removed the OldValuesParameterFormatString="original_{0}" from the
objectdatasource as suggested many places... this is how the update and the
delete came to work, but insert is still messed up. How to debug this? When
I put breakpoints into my data access layer (autogenerated by the designer)
they don't even break. They don't break for update or delete either so where
the heck is it running the code to update and delete? This is FRUSTRATING,
anyone got any answers?

Apr 27 '06 #1
1 4231
It seems this problem occurs when the wiring between the objectdatasource and
your DAL get out of synch. It actually cleared up for me as I continued to
work on my DAL, adding columns etc. and regenning, but if you're desperate to
just get it to work, you can "hardwire" the parameters to the failing method
with code similar to the following...

First define a OnInserting event in your ObjDataSource:

<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
DeleteMethod="Delete" InsertMethod="Insert" OnInserting="DS1Inserting"
SelectMethod="GetContacts" OnUpdating="DS1Updating"
TypeName="DataAccess.ptsContactsTableAdapters.ptsC ontactsTableAdapter"
UpdateMethod="Update">

Then put a method in your code to handle things manually. The routine below
wipes out the autogenerated parameters and reassigns the parameters to match
the assigned INSERT method in my DAL:

protected void DS1Inserting(object source, ObjectDataSourceMethodEventArgs e)
{
//Modify input params because objectdatasource is too dumb to figure
it out...
IDictionary paramsFromPage = e.InputParameters;

string last_name = e.InputParameters[0].ToString();
string first_name = e.InputParameters[1].ToString();
string email = e.InputParameters[2].ToString();
int role_id = Int32.Parse(e.InputParameters[3].ToString());
string user_id = e.InputParameters[4].ToString();

paramsFromPage.Clear();
paramsFromPage.Add("last_name", last_name);
paramsFromPage.Add("first_name", first_name);
paramsFromPage.Add("email", email);
paramsFromPage.Add("role_id", role_id);
paramsFromPage.Add("user_id", user_id);
}

"tparks69" wrote:
I get the error:

ObjectDataSource 'ObjectDataSource1' could not find a non-generic method
'Insert' that has parameters: last_name, first_name, email, role_id, user_id,
modified_by, modified_date

when my application is trying to insert a record from a formview.

It works fine for delete, update, but insert just keeps failing. I have
removed the OldValuesParameterFormatString="original_{0}" from the
objectdatasource as suggested many places... this is how the update and the
delete came to work, but insert is still messed up. How to debug this? When
I put breakpoints into my data access layer (autogenerated by the designer)
they don't even break. They don't break for update or delete either so where
the heck is it running the code to update and delete? This is FRUSTRATING,
anyone got any answers?

May 4 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Trail Monster | last post by:
Ok, I've been searching the net now for several days and can't find how to do this anywhere. Version: VS 2005 Professional Release, 2.0 Framework Background: I have a complex business object...
3
by: Jeronimo Bertran | last post by:
I have a FormView that shows details of a specific record on a table. The SelecMethod returns a DataSet that includes all the fields from my Event table and other read-only fields from linked...
10
by: J055 | last post by:
Hi I've been trying out SqlCacheDependency using the ObjectDataSource and SQL Server 2005. It all works quite well with the minimum of configuration, e.g. <asp:ObjectDataSource...
11
by: Norbert Ruessmann | last post by:
Hello group, I have a problem with ObjectDataSource and ITypedList. At the end of this entry you find the implementatiopn of my List class, derived from ArrayList and implementing ITypedList....
4
by: J055 | last post by:
Hi I thought I was trying to do something very simple but I'm have a lot of trouble trying to do the following. <asp:FormView ID="fvGroups" runat="server" DataKeyNames="GroupID"...
14
by: Rolf Welskes | last post by:
Hello, I have an ObjectDataSource which has as business-object a simple array of strings. No problem. I have an own (custom) control to which I give the DataSourceId and in the custom-control...
0
by: Anabela Silva | last post by:
To anyone who has experienced this problem! Could not find a property named '... ' on the type specified by the DataObjectTypeName property in ObjectDataSource '...' I've been looking at...
3
by: Doug Salomon | last post by:
Hi, Recently, my site has been generating errors which say: "Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled...
0
by: GMartin | last post by:
I have a pop-up form with a three columned Grid that has checkboxes in a Template Column in the first/left-most column. (The form is to allow users to select "Members" of a group, where they check...
0
by: =?Utf-8?B?UGF1bA==?= | last post by:
I have a ListBox server control named "lb_dates" with a SelectionMode of "Multiple". The user can select multiple dates from the listbox. I have ObjectDataSource named "ods_rfq" with a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.