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

Discussion in 'ASP .Net' started by Cirene, Sep 17, 2008.

  1. Cirene

    Cirene Guest

    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...
     
    Cirene, Sep 17, 2008
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dotnet Gruven
    Replies:
    1
    Views:
    5,195
    Steven Cheng[MSFT]
    Sep 14, 2005
  2. =?Utf-8?B?dHBhcmtzNjk=?=

    ObjectDataSource could not find a non-generic method error

    =?Utf-8?B?dHBhcmtzNjk=?=, Apr 27, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    14,585
    =?Utf-8?B?dHBhcmtzNjk=?=
    May 4, 2006
  3. Dennis
    Replies:
    0
    Views:
    1,160
    Dennis
    Jul 1, 2006
  4. Replies:
    0
    Views:
    704
  5. tparks69
    Replies:
    0
    Views:
    148
    tparks69
    Apr 27, 2006
Loading...

Share This Page