Error: ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'InsertState' that h

C

Cirene

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,015
Latest member
AmbrosePal

Latest Threads

Top