locked
'ObjectDataSource' could not find a non-generic method that has parameters some parameters RRS feed

  • Question

  • User2139087810 posted

    Plz help, i got the following error when i insert new record using DetailsView and Oracle Procedures.

    ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'InsertSurvey' that has parameters: DESCRIPTION, startDate, endDate, ISOPEN, SURVEYID, START_DATE, END_DATE.

    in app_code folder SurveyDataAccess.cs file is

    public static int InsertSurvey(
    
                         string description,
                         DateTime startDate,
                         DateTime endDate,
                         int isOPEN)
    {
        int rowsAffected = 0;
    
        using (OracleConnection connection = ConnectionManager.getSohaibOracleConnection())
        {
            OracleCommand command = new OracleCommand("INSERTSURVEY", connection);
            command.CommandType = CommandType.StoredProcedure;
    
            command.Parameters.Add("P_DESCRIPTION", OracleDbType.Varchar2, 50).Value = description;
            command.Parameters.Add("P_START_DATE", OracleDbType.Date).Value = startDate;
            command.Parameters.Add("P_END_DATE", OracleDbType.Date).Value = endDate;
            command.Parameters.Add("P_ISOPEN", OracleDbType.Int32).Value = isOPEN;
    
            rowsAffected = command.ExecuteNonQuery();
        }
        return rowsAffected;
    }
    

    and CreateSurvey.aspx file is

    <fieldset>
    <legend>Creat a Survey</legend>
    <asp:Label ID="lblSurveyResult" runat="server"></asp:Label>
        <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
            InsertMethod="InsertSurvey" SelectMethod="getAllSurvey" 
            TypeName="SurveyDataAccess">
            <InsertParameters>
                <asp:Parameter Name="description" Type="String" />
                <asp:Parameter Name="startDate" Type="DateTime" />
                <asp:Parameter Name="endDate" Type="DateTime" />
                <asp:Parameter Name="isOPEN" Type="Int32" />
            </InsertParameters>
        </asp:ObjectDataSource>
    
        <asp:DetailsView ID="SurveyDetailsView" runat="server" 
            DataSourceID="ObjectDataSource1" Height="50px" 
            onmodechanging="SurveyDetailsView_ModeChanging" Width="222px">
            <Fields>
                <asp:CommandField ShowInsertButton="True" />
            </Fields>
        </asp:DetailsView>
    
    </fieldset>

    and Procedure in Oracle is:

    CREATE OR REPLACE PROCEDURE insertSurvey  (
        p_DESCRIPTION in survey.description%TYPE,
        p_START_DATE in survey.start_date%TYPE,
        p_END_DATE in survey.end_date%TYPE,
        p_ISOPEN in survey.isopen%TYPE
        )
    AS  
    BEGIN
    INSERT INTO SURVEY (
            DESCRIPTION, 
            START_DATE,
            END_DATE,
            ISOPEN )
        VALUES (
             p_DESCRIPTION,
             p_START_DATE,
             p_END_DATE,
             p_ISOPEN) ;
    COMMIT; 
        END ;

    Please help me on this issue or suggest detailed alternate. thanx.


    Thursday, January 31, 2013 8:30 AM

All replies