sql datasource select method

Posted on 2009-02-10
Last Modified: 2012-05-06
I get the following error, I am getting the value from the first drop down list departmentid.
Then passing this value to a stored procedure using the selectmethod of the second drop down list.

ObjectDataSource 'objdsAddColleague' could not find a non-generic method 'seladddepColleagueDetails' that has parameters: strConn, DepartmentID.
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 'objdsAddColleague' could not find a non-generic method 'seladddepColleagueDetails' that has parameters: strConn, DepartmentID.

My aspx page.

    <table id="tblDepartmentSelection" width="100%" border="0" style="border-bottom-width:1px; border-bottom-color:Black; border-bottom-style:solid" cellpadding="0" cellspacing="0" class="">


            <td align="center" style="height: 65px">

                <asp:DropDownList ID="ddlDepartment" runat="server" CssClass="" DataSourceID="objDepartmentDetails" Datatextfield="DepartmentName" DataValueField="DepartmentID" AutoPostBack="true">


                <asp:ObjectDataSource ID="objDepartmentDetails" runat="server" SelectMethod="GenericQuery" TypeName="WAB_DataAccessWS.WAB_DataAccessWS">


                        <asp:ControlParameter ControlID="hdnMainConnStr" Name="strConn" PropertyName="Value" Type="String"/>

                        <asp:Parameter defaultvalue="exec p_DepartmentDetails" name="strQuery" type="String" />






                <asp:DropDownList ID="ddlAddColleague" runat="server" CssClass="" DataSourceID="objdsAddColleague" DataValueField="ColleagueName" Datatextfield="ColleagueName" AutoPostBack="true">


                <asp:ObjectDataSource ID="objdsAddColleague" runat="server" SelectMethod="seladddepColleagueDetails" TypeName="WAB_DataAccessWS.WAB_DataAccessWS">


                        <asp:ControlParameter ControlID="hdnMainConnStr" Name="strConn" PropertyName="Value" Type="String"/>

                        <asp:ControlParameter ControlID="ddlDepartment" Name="DepartmentID" PropertyName="SelectedValue" Type="Int32" />



My web service

    'Select add colleague

    <WebMethod()> _

    Public Function seladdColleagueDetails(ByVal strConn As String, ByVal DepartmentID As Integer) As Integer

        Return WAB_DataAccess.seladddepColleagueDetails(strConn, DepartmentID)

    End Function

My cls

    'Select method from webservice add colleaguedepartment

    Public Shared Function seladddepColleagueDetails(ByVal strConn As String, ByVal intDepartmentID As Integer) As Integer

        Using conn As New sqlconnection(strConn)

            Using cmd As New SqlCommand("p_AddColleague", conn)

                cmd.CommandType = CommandType.StoredProcedure

                cmd.Parameters.AddWithValue("DepartmentID", intDepartmentID)



                    Return cmd.ExecuteNonQuery()

                Catch ex As Exception

                End Try

            End Using

        End Using

    End Function

Open in new window

Question by:aneilg
    LVL 16

    Accepted Solution

    Try replacing line 24 like this

                            <asp:ControlParameter ControlID="ddlDepartment" Name="intDepartmentID" PropertyName="SelectedValue" Type="Int32" />

    Open in new window


    Author Comment

    I think i mite have tried that i'll have a look in the morning.

    Thanks for your help.


    Author Comment

    Thanks for that i was calling seladddepColleagueDetails instead of seladdColleagueDetails

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Using Quotation Marks in PHP This question ( seems to come up a lot for developers who are new to PHP.  And it got me thinking, "How can we explain the rule…
    Thoughout my experience working on eCommerce web applications I have seen applications succumbing to increased user demand and throughput. With increased loads the response times started to spike, which leads to user frustration and lost sales. I ha…
    This video teaches viewers how to create their own website using cPanel and Wordpress. Tutorial walks users through how to set up their own domain name from tools like Domain Registrar, Hosting Account, and Wordpress. More specifically, the order in…
    Use Wufoo, an online form creation tool, to make powerful forms. Learn how to selectively show certain fields based on user input using rules to gather relevant information and data from your forms. The rules feature provides you with an opportunity…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now