473,503 Members | 2,313 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error: ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'InsertState' that has parameters: UsState, UsStateAbbreviation, StateId.

Using Visual Studio I created a DataSet using the GUI (XSD file).

Trying to use a tiered methodology I called the functions from my BLL.

Namespace Zzz.BusinessLogicLayer
#Region "DAL Access"
Public Class States
Public Sub New()
End Sub

Public Shared Function GetAllStates() As DataTable
Using db As New dsStatesTableAdapters.statesTableAdapter
Return db.GetData()
End Using
End Function

Public Shared Sub InsertState(ByVal UsState As String, ByVal
UsStateAbbreviation As String)
Using db As New dsStatesTableAdapters.statesTableAdapter
db.Insert(UsState, UsStateAbbreviation)
End Using
End Sub

Public Shared Sub UpdateState(ByVal UsState As String, ByVal
UsStateAbbreviation As String, ByVal original_StateId As Long)
Using db As New dsStatesTableAdapters.statesTableAdapter
db.Update(UsState, UsStateAbbreviation, original_StateId)
End Using
End Sub

Public Shared Sub DeleteState(ByVal Original_StateId As Long)
Using db As New dsStatesTableAdapters.statesTableAdapter
db.Delete(Original_StateId)
End Using
End Sub
End Class
#End Region
End Namespace
I got the default Select, Update, and Delete working, but the Insert keeps
giving me this error...

ObjectDataSource 'ObjectDataSource1' could not find a non-generic method
'InsertState' that has parameters: UsState, UsStateAbbreviation, StateId.
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.

Exception Details: System.InvalidOperationException: ObjectDataSource
'ObjectDataSource1' could not find a non-generic method 'InsertState' that
has parameters: UsState, UsStateAbbreviation, StateId.
I'm using a DetailsView to insert the records. Here's the simple layout of
my form...
<asp:GridView ID="GridView1" runat="server" DataKeyNames="StateId"
DataSourceID="ObjectDataSource1">
<Columns>
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True"
ShowSelectButton="True" />
</Columns>
</asp:GridView>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
DeleteMethod="DeleteState" InsertMethod="InsertState"
OldValuesParameterFormatString="original_{0}"
SelectMethod="GetAllStates"
TypeName="Zzz.BusinessLogicLayer.States" UpdateMethod="UpdateState">
<DeleteParameters>
<asp:Parameter Name="Original_StateId" Type="Int64" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="UsState" Type="String" />
<asp:Parameter Name="UsStateAbbreviation" Type="String" />
<asp:Parameter Name="original_StateId" Type="Int64" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="UsState" Type="String" />
<asp:Parameter Name="UsStateAbbreviation" Type="String" />
</InsertParameters>
</asp:ObjectDataSource>
<asp:DetailsView ID="DetailsView1" runat="server" DataKeyNames="StateId"
DataSourceID="ObjectDataSource1" DefaultMode="Insert" Height="50px"
Width="125px">
<Fields>
<asp:CommandField ShowInsertButton="True" />
</Fields>
</asp:DetailsView>
Any ideas what I'm doing wrong???

Thanks...
Sep 16 '08 #1
0 1529

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

Similar topics

3
6869
by: Robert | last post by:
What is the best way to pass a parameter to an ObjectDataSource. I am able to add a new parameter to the SelectParameters, but I would like to just assign a value to an existing parmeter at...
2
12773
by: planetthoughtful | last post by:
Hi All, I have an ASP.NET page that displays a GridView control based on an ObjectDataSource control. I'm wondering if it's possible to base the ObjectDataSource in question on a parameter...
1
1164
by: Hugo Flores | last post by:
I bound the items of a DropDownList with an ObjectDataSource, but I also want to add a new item at top with an option that would say All, and an emtpy value. I tried this Private Sub...
2
6760
by: Olivier Matrot | last post by:
Hello, I'm using a gridview with objectdatasource and custom objects collections SELECT/INSERT/UPDATE/DELETE methods are using custom objects as parameters. This is working fine. But I have a...
1
3354
by: vncntj | last post by:
I have this class file within the App_Code folder CorrectionsDB.cs namespace CorrectionsDB.cs { using System; using System.Data; using System.Configuration; using System.Web;
5
2620
by: Randy Smith | last post by:
Hi ALL, I wonder if anyone has been using n-tier to bind to a GridView control by using the ObjectDataSource. This is our first OOP web application, and we have no tables. Right now we are...
0
1617
by: =?Utf-8?B?RGVuaXMgU29oZXQ=?= | last post by:
Hi all, I've created a new project to test ObjectDataSource component. I've just added a new objectdatasource, configured it (linked to a table) etc ... It works fine on localhost, i can...
0
1020
by: mrajanikrishna | last post by:
Hi friends, I have placed a GridView and its DataSourceId is ObjectDaatSource1. <asp:ObjectDataSource id="ObjectDataSource1" runat=server TypeName="AuthorsDb" SelectMethod="GetStates"/> My...
1
2239
by: =?Utf-8?B?SGFycmlzb24gU2Nob2ZpbGw=?= | last post by:
I've got a developer who is running into problems getting a web app to write to a SQL database. I am posting his error message. Any ideas? Server Error in '/CTRS Web' Application....
17
20307
by: =?Utf-8?B?SGVyYg==?= | last post by:
I have created a report and subreport in VB/ASP.NET. The report works fine but the subreport will not display. The subreport, when displayed as a standalone report, works fine. Any help I can...
0
7194
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
7267
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,...
0
7449
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5566
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4993
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3160
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3148
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
729
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.